diff options
author | 2020-01-04 14:39:53 +0100 | |
---|---|---|
committer | 2020-01-04 14:39:53 +0100 | |
commit | 123d916b0ce9eaeb53c2d06ad6504729af8688ee (patch) | |
tree | d34a41b645e3dbb91a79b81f1e45101dae7f61d2 /qkeyword.c | |
parent | qkeyword/qlist: replace strtok by strtok_r (diff) | |
download | portage-utils-123d916b0ce9eaeb53c2d06ad6504729af8688ee.tar.gz portage-utils-123d916b0ce9eaeb53c2d06ad6504729af8688ee.tar.bz2 portage-utils-123d916b0ce9eaeb53c2d06ad6504729af8688ee.zip |
qkeyword: avoid NULL derefence if strtok_r's initial call returns NULL
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Diffstat (limited to 'qkeyword.c')
-rw-r--r-- | qkeyword.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -190,13 +190,13 @@ read_keywords(char *s, int *keywords) if (!slen) return 0; - arch = strtok_r(s, delim, &savep); - do { + while ((arch = strtok_r(s, delim, &savep)) != NULL) { + s = NULL; /* for strtok_r */ i = decode_arch(arch); if (i == -1) continue; keywords[i] = decode_status(arch[0]); - } while ((arch = strtok_r(NULL, delim, &savep))); + } return 0; } |