[source] swconfig: Bugfix switch_port uci option parsing

LEDE Commits lede-commits at lists.infradead.org
Wed Mar 1 11:38:14 PST 2017


jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/3d52251df42c810e84c712f8dded2fe3af44f7e6

commit 3d52251df42c810e84c712f8dded2fe3af44f7e6
Author: Ben Kelly <ben at benjii.net>
AuthorDate: Mon Feb 20 14:04:30 2017 +0200

    swconfig: Bugfix switch_port uci option parsing
    
    When not defining 'device' or 'vlan' in relevant switch_port uci
    sections, behaviour is inconsistent due to *devn, *port and *vlan
    pointers not being zero initialized.
    
    Signed-off-by: Ben Kelly <ben at benjii.net>
---
 package/network/config/swconfig/src/uci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/network/config/swconfig/src/uci.c b/package/network/config/swconfig/src/uci.c
index b541b71..bf76bd3 100644
--- a/package/network/config/swconfig/src/uci.c
+++ b/package/network/config/swconfig/src/uci.c
@@ -165,7 +165,7 @@ found:
 		s = uci_to_section(e);
 
 		if (!strcmp(s->type, "switch_port")) {
-			char *devn, *port, *port_err = NULL;
+			char *devn = NULL, *port = NULL, *port_err = NULL;
 			int port_n;
 
 			uci_foreach_element(&s->options, os) {
@@ -190,7 +190,7 @@ found:
 
 			swlib_map_settings(dev, SWLIB_ATTR_GROUP_PORT, port_n, s);
 		} else if (!strcmp(s->type, "switch_vlan")) {
-			char *devn, *vlan, *vlan_err = NULL;
+			char *devn = NULL, *vlan = NULL, *vlan_err = NULL;
 			int vlan_n;
 
 			uci_foreach_element(&s->options, os) {



More information about the lede-commits mailing list