From: <kam...@us...> - 2011-02-21 19:32:06
|
Revision: 3058 http://hamlib.svn.sourceforge.net/hamlib/?rev=3058&view=rev Author: kamalmostafa Date: 2011-02-21 19:32:00 +0000 (Mon, 21 Feb 2011) Log Message: ----------- Fix segfault on improper -C syntax Avoid null pointer segfault when -C param is specified with no '=' e.g. "rigctl -C foo". Thanks to Charles Suprin <ham...@gm...> for the report. Modified Paths: -------------- trunk/rpcrig/rpcrigd.c trunk/tests/rigctl_parse.c trunk/tests/rigmem.c trunk/tests/rigsmtr.c trunk/tests/rigswr.c trunk/tests/rotctl_parse.c Modified: trunk/rpcrig/rpcrigd.c =================================================================== --- trunk/rpcrig/rpcrigd.c 2011-02-19 02:58:11 UTC (rev 3057) +++ trunk/rpcrig/rpcrigd.c 2011-02-21 19:32:00 UTC (rev 3058) @@ -91,7 +91,9 @@ while (p && *p != '\0') { /* FIXME: left hand value of = cannot be null */ q = strchr(p, '='); - if (q) *q++ = '\0'; + if ( !q ) + return RIG_EINVAL; + *q++ = '\0'; n = strchr(q, ','); if (n) *n++ = '\0'; Modified: trunk/tests/rigctl_parse.c =================================================================== --- trunk/tests/rigctl_parse.c 2011-02-19 02:58:11 UTC (rev 3057) +++ trunk/tests/rigctl_parse.c 2011-02-21 19:32:00 UTC (rev 3058) @@ -661,7 +661,9 @@ while (p && *p != '\0') { /* FIXME: left hand value of = cannot be null */ q = strchr(p, '='); - if (q) *q++ = '\0'; + if ( !q ) + return RIG_EINVAL; + *q++ = '\0'; n = strchr(q, ','); if (n) *n++ = '\0'; Modified: trunk/tests/rigmem.c =================================================================== --- trunk/tests/rigmem.c 2011-02-19 02:58:11 UTC (rev 3057) +++ trunk/tests/rigmem.c 2011-02-21 19:32:00 UTC (rev 3058) @@ -347,7 +347,9 @@ while (p && *p != '\0') { /* FIXME: left hand value of = cannot be null */ q = strchr(p, '='); - if (q) *q++ = '\0'; + if ( !q ) + return RIG_EINVAL; + *q++ = '\0'; n = strchr(q, ','); if (n) *n++ = '\0'; Modified: trunk/tests/rigsmtr.c =================================================================== --- trunk/tests/rigsmtr.c 2011-02-19 02:58:11 UTC (rev 3057) +++ trunk/tests/rigsmtr.c 2011-02-21 19:32:00 UTC (rev 3058) @@ -355,7 +355,9 @@ while (p && *p != '\0') { /* FIXME: left hand value of = cannot be null */ q = strchr(p, '='); - if (q) *q++ = '\0'; + if ( !q ) + return RIG_EINVAL; + *q++ = '\0'; n = strchr(q, ','); if (n) *n++ = '\0'; Modified: trunk/tests/rigswr.c =================================================================== --- trunk/tests/rigswr.c 2011-02-19 02:58:11 UTC (rev 3057) +++ trunk/tests/rigswr.c 2011-02-21 19:32:00 UTC (rev 3058) @@ -303,7 +303,9 @@ while (p && *p != '\0') { /* FIXME: left hand value of = cannot be null */ q = strchr(p, '='); - if (q) *q++ = '\0'; + if ( !q ) + return RIG_EINVAL; + *q++ = '\0'; n = strchr(q, ','); if (n) *n++ = '\0'; Modified: trunk/tests/rotctl_parse.c =================================================================== --- trunk/tests/rotctl_parse.c 2011-02-19 02:58:11 UTC (rev 3057) +++ trunk/tests/rotctl_parse.c 2011-02-21 19:32:00 UTC (rev 3058) @@ -555,7 +555,9 @@ while (p && *p != '\0') { /* FIXME: left hand value of = cannot be null */ q = strchr(p, '='); - if (q) *q++ = '\0'; + if ( !q ) + return RIG_EINVAL; + *q++ = '\0'; n = strchr(q, ','); if (n) *n++ = '\0'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |