Off-by-one memory access bugfix.
authorOleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
Fri, 29 Aug 2014 09:47:50 +0000 (12:47 +0300)
committerSamuel Ortiz <sameo@linux.intel.com>
Sun, 7 Sep 2014 22:40:51 +0000 (00:40 +0200)
Terminate on endParsing before dereferencing argEnd.

ncl/ncl.c

index 243fd59..bee639a 100644 (file)
--- a/ncl/ncl.c
+++ b/ncl/ncl.c
@@ -164,8 +164,7 @@ static NCLError ncl_prv_split_cmdLine(gchar  *cmdLine, int *iArgc,
        inQuotes = false;
 
        argStart = argEnd = cmdLine;
-       while ((*argc) < NB_MAX_PARAMETERS && *argEnd != '\0' &&
-               endParsing == FALSE) {
+       while (endParsing == FALSE && *argc < NB_MAX_PARAMETERS && *argEnd) {
                while (*argEnd != ' ' && *argEnd != '"' && *argEnd != '\0')
                        argEnd++;
                if (*argEnd == '"') {