diff --git a/dmtree/tr181/dhcpv4.c b/dmtree/tr181/dhcpv4.c index 41a4a76d..123d21c9 100644 --- a/dmtree/tr181/dhcpv4.c +++ b/dmtree/tr181/dhcpv4.c @@ -290,7 +290,7 @@ static void dhcp_leases_load(struct list_head *head) static int interface_get_ipv4(const char *iface, uint32_t *addr, unsigned *bits) { - json_object *res; + json_object *res = NULL; const char *addr_str = NULL; int addr_cidr = -1; @@ -2114,7 +2114,7 @@ static int set_DHCPv4ClientSentOption_Value(char *refparam, struct dmctx *ctx, v dmuci_set_value_by_section_bbfdm(dhcp_client_s->dmmap_sect, "option_value", res); if (tag_enabled) { - char new_tag_value[128] = {0}; + char new_tag_value[512] = {0}; snprintf(new_tag_value, sizeof(new_tag_value), "%s:%s", dhcp_client_s->option_tag, res); add_elt_to_str_list(&sendopts, new_tag_value); @@ -2452,7 +2452,7 @@ static int set_DHCPv4ServerPoolOption_Value(char *refparam, struct dmctx *ctx, v convert_hex_to_string(value, res); if (option_enabled) { - char new_tag_value[128] = {0}, old_tag_value[128] = {0}; + char new_tag_value[512] = {0}, old_tag_value[128] = {0}; snprintf(old_tag_value, sizeof(old_tag_value), "%s,%s", dhcp_client_s->option_tag, dhcp_client_s->value); snprintf(new_tag_value, sizeof(new_tag_value), "%s,%s", dhcp_client_s->option_tag, res); diff --git a/dmtree/tr181/dhcpv6.c b/dmtree/tr181/dhcpv6.c index 19d3bd7e..fb0aa502 100644 --- a/dmtree/tr181/dhcpv6.c +++ b/dmtree/tr181/dhcpv6.c @@ -1286,7 +1286,7 @@ static int set_DHCPv6ServerPoolOption_Value(char *refparam, struct dmctx *ctx, v convert_hex_to_string(value, res); if (option_enabled) { - char new_tag_value[128] = {0}, old_tag_value[128] = {0}; + char new_tag_value[512] = {0}, old_tag_value[128] = {0}; snprintf(old_tag_value, sizeof(old_tag_value), "%s,%s", dhcpv6_client_s->option_tag, dhcpv6_client_s->value); snprintf(new_tag_value, sizeof(new_tag_value), "%s,%s", dhcpv6_client_s->option_tag, res); diff --git a/dmtree/tr181/dns.c b/dmtree/tr181/dns.c index a34aeab1..2b9f36ab 100644 --- a/dmtree/tr181/dns.c +++ b/dmtree/tr181/dns.c @@ -30,7 +30,7 @@ static unsigned char is_dns_server_in_dmmap(char *chk_ip, char *chk_interface) static int dmmap_synchronizeDNSClientRelayServer(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - json_object *jobj, *arrobj = NULL; + json_object *jobj = NULL, *arrobj = NULL; struct uci_list *v; struct uci_element *e = NULL; struct uci_section *s = NULL, *sdns = NULL, *stmp = NULL, *ss; diff --git a/dmtree/tr181/dsl.c b/dmtree/tr181/dsl.c index 5c2f77ef..fe54cc7f 100644 --- a/dmtree/tr181/dsl.c +++ b/dmtree/tr181/dsl.c @@ -169,7 +169,7 @@ static int browseDSLChannelInst(struct dmctx *dmctx, DMNODE *parent_node, void * ***************************************************************************/ static char *get_dsl_value_without_argument(char *command1, char *id, char *command2, char *key) { - json_object *res; + json_object *res = NULL; char command[16], *value = "0"; snprintf(command, sizeof(command), "%s.%s", command1, id); @@ -181,7 +181,7 @@ static char *get_dsl_value_without_argument(char *command1, char *id, char *comm static char *get_dsl_value_without_argument_and_with_two_key(char *command1, char *id, char *command2, char *key1, char *key2) { - json_object *res; + json_object *res = NULL; char command[16], *value = "0"; snprintf(command, sizeof(command), "%s.%s", command1, id); @@ -193,7 +193,7 @@ static char *get_dsl_value_without_argument_and_with_two_key(char *command1, cha char *get_value_with_argument(char *command1, char *id, char *command2, char *argument, char *key) { - json_object *res; + json_object *res = NULL; char command[16], *value = "0"; snprintf(command, sizeof(command), "%s.%s", command1, id); @@ -205,7 +205,7 @@ char *get_value_with_argument(char *command1, char *id, char *command2, char *ar static char *get_dsl_value_array_without_argument(char *command1, char *id, char *command2, char *key) { - json_object *res; + json_object *res = NULL; char command[16], *value= "0"; snprintf(command, sizeof(command), "%s.%s", command1, id); diff --git a/dmtree/tr181/fast.c b/dmtree/tr181/fast.c index a9b8ae4e..37b6def4 100644 --- a/dmtree/tr181/fast.c +++ b/dmtree/tr181/fast.c @@ -97,7 +97,7 @@ static int browseFASTLineInst(struct dmctx *dmctx, DMNODE *parent_node, void *pr ***************************************************************************/ static char *get_fast_value_without_argument(char *command1, char *id, char *command2, char *key) { - json_object *res; + json_object *res = NULL; char command[16], *value = "0"; snprintf(command, sizeof(command), "%s.%s", command1, id); @@ -109,7 +109,7 @@ static char *get_fast_value_without_argument(char *command1, char *id, char *com static char *get_fast_value_without_argument_and_with_two_key(char *command1, char *id, char *command2, char *key1, char *key2) { - json_object *res; + json_object *res = NULL; char command[16], *value = "0"; snprintf(command, sizeof(command), "%s.%s", command1, id); @@ -121,7 +121,7 @@ static char *get_fast_value_without_argument_and_with_two_key(char *command1, ch static char *get_fast_value_array_without_argument(char *command1, char *id, char *command2, char *key) { - json_object *res; + json_object *res = NULL; char command[16], *value= "0"; snprintf(command, sizeof(command), "%s.%s", command1, id); diff --git a/dmtree/tr181/upnp.c b/dmtree/tr181/upnp.c index 18e550e6..1acec34c 100644 --- a/dmtree/tr181/upnp.c +++ b/dmtree/tr181/upnp.c @@ -463,7 +463,7 @@ static int get_UPnPDiscovery_RootDeviceNumberOfEntries(char *refparam, struct dm static int get_UPnPDiscovery_DeviceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - json_object *res, *devices; + json_object *res = NULL, *devices; *value = "0"; dmubus_call("upnpc", "discovery", UBUS_ARGS{{}}, 0, &res); @@ -481,7 +481,7 @@ static int get_UPnPDiscovery_DeviceNumberOfEntries(char *refparam, struct dmctx static int get_UPnPDiscovery_ServiceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - json_object *res, *services; + json_object *res = NULL, *services; *value = "0"; dmubus_call("upnpc", "discovery", UBUS_ARGS{{}}, 0, &res); @@ -565,7 +565,7 @@ static int get_UPnPDiscoveryService_ParentDevice(char *refparam, struct dmctx *c static int get_UPnPDescription_DeviceDescriptionNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - json_object *res, *descriptions; + json_object *res = NULL, *descriptions; *value = "0"; dmubus_call("upnpc", "description", UBUS_ARGS{{}}, 0, &res); @@ -583,7 +583,7 @@ static int get_UPnPDescription_DeviceDescriptionNumberOfEntries(char *refparam, static int get_UPnPDescription_DeviceInstanceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - json_object *res, *devicesinstances; + json_object *res = NULL, *devicesinstances; *value = "0"; dmubus_call("upnpc", "description", UBUS_ARGS{{}}, 0, &res); @@ -601,7 +601,7 @@ static int get_UPnPDescription_DeviceInstanceNumberOfEntries(char *refparam, str static int get_UPnPDescription_ServiceInstanceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - json_object *res, *servicesinstances; + json_object *res = NULL, *servicesinstances; *value = "0"; dmubus_call("upnpc", "description", UBUS_ARGS{{}}, 0, &res); diff --git a/dmtree/tr181/usb.c b/dmtree/tr181/usb.c index 90a48fde..8df85c85 100644 --- a/dmtree/tr181/usb.c +++ b/dmtree/tr181/usb.c @@ -788,7 +788,7 @@ static int get_USBUSBHostsHost_Type(char *refparam, struct dmctx *ctx, void *dat static int get_USBUSBHostsHost_PowerManagementEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - char power[64]; + char power[64] = {0}; __read_sysfs_usb_port(data, "power/level", power, sizeof(power)); @@ -1018,7 +1018,7 @@ static int get_USBUSBHostsHostDevice_MaxChildren(char *refparam, struct dmctx *c static int get_USBUSBHostsHostDevice_IsSuspended(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - char status[16]; + char status[16] = {0}; __read_sysfs_usb_port(data, "power/runtime_status", status, sizeof(status)); if(strncmp(status, "suspended", 9) == 0)