]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
bug fix : NULL pointer 1706/head
authorLeeYoung624 <liyiang@hotmail.com>
Mon, 29 Jul 2019 09:05:50 +0000 (17:05 +0800)
committerLeeYoung624 <liyiang@hotmail.com>
Mon, 29 Jul 2019 09:05:50 +0000 (17:05 +0800)
programs/util.c

index fb77d17839281413e26b4b7f3a016e7662455cef..347e769866e9d66f4528a7d746793cf43bbbd508 100644 (file)
@@ -494,7 +494,7 @@ int UTIL_countPhysicalCores(void)
             if (fgets(buff, BUF_SIZE, cpuinfo) != NULL) {
                 if (strncmp(buff, "siblings", 8) == 0) {
                     const char* const sep = strchr(buff, ':');
-                    if (*sep == '\0') {
+                    if (sep == NULL || *sep == '\0') {
                         /* formatting was broken? */
                         goto failed;
                     }
@@ -503,7 +503,7 @@ int UTIL_countPhysicalCores(void)
                 }
                 if (strncmp(buff, "cpu cores", 9) == 0) {
                     const char* const sep = strchr(buff, ':');
-                    if (*sep == '\0') {
+                    if (sep == NULL || *sep == '\0') {
                         /* formatting was broken? */
                         goto failed;
                     }