From: LeeYoung624 Date: Mon, 29 Jul 2019 09:05:50 +0000 (+0800) Subject: bug fix : NULL pointer X-Git-Tag: v1.4.3^2~4^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5caaf52a447f9d7bc34c9df775226bee569f6b4;p=thirdparty%2Fzstd.git bug fix : NULL pointer --- diff --git a/programs/util.c b/programs/util.c index fb77d1783..347e76986 100644 --- a/programs/util.c +++ b/programs/util.c @@ -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; }