]> xenbits.xensource.com Git - people/pauldu/xenbus.git/commitdiff
Fix potential NULL-pointer dereference...
authorPaul Durrant <paul.durrant@citrix.com>
Wed, 5 Aug 2015 11:58:45 +0000 (12:58 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Wed, 5 Aug 2015 11:58:45 +0000 (12:58 +0100)
...in parsing SystemStartOptions.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
src/common/registry.c

index 2389c33f264d2073151537d0ef18ab8e6ef662a6..d6499c15b4eda56e1a1813632cec571872fd8080 100644 (file)
@@ -1155,13 +1155,13 @@ RegistryQuerySystemStartOption(
     Length = (ULONG)strlen(Prefix);
 
     Option = __strtok_r(Ansi[0].Buffer, " ", &Context);
-    if (strncmp(Prefix, Option, Length) == 0)
-        goto found;
-
-    while ((Option = __strtok_r(NULL, " ", &Context)) != NULL)
+    while (Option != NULL) {
         if (strncmp(Prefix, Option, Length) == 0)
             goto found;
 
+        Option = __strtok_r(NULL, " ", &Context);
+    }
+
     status = STATUS_OBJECT_NAME_NOT_FOUND;
     goto fail3;