From: Arran Cudbard-Bell Date: Sun, 3 Nov 2019 19:41:02 +0000 (-0600) Subject: CID 1455236 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41c8ae729f6d111bd391813f07c1746d461cea19;p=thirdparty%2Ffreeradius-server.git CID 1455236 --- diff --git a/src/lib/util/misc.c b/src/lib/util/misc.c index 4f3992228d7..a5859b4629a 100644 --- a/src/lib/util/misc.c +++ b/src/lib/util/misc.c @@ -686,25 +686,17 @@ static char *mystrtok(char **ptr, char const *sep) { char *res; - if (**ptr == 0) { - return NULL; - } + if (**ptr == '\0') return NULL; - while (**ptr && strchr(sep, **ptr)) { - (*ptr)++; - } - if (**ptr == 0) { - return NULL; - } + while (**ptr && strchr(sep, **ptr)) (*ptr)++; + + if (**ptr == '\0') return NULL; res = *ptr; - while (**ptr && strchr(sep, **ptr) == NULL) { - (*ptr)++; - } + while (**ptr && strchr(sep, **ptr) == NULL) (*ptr)++; + + if (**ptr != '\0') *(*ptr)++ = '\0'; - if (**ptr != 0) { - *(*ptr)++ = 0; - } return res; } @@ -904,7 +896,7 @@ int fr_unix_time_from_str(fr_unix_time_t *date, char const *date_str) * * Otherwise, ignore errors and assume GMT. */ - if (p) { + if (*p != '\0') { fr_skip_whitespace(p); (void) fr_time_delta_from_time_zone(p, &gmtoff); }