]> git.ipfire.org Git - location/libloc.git/commitdiff
stringpool: Do not call strlen() on potential NULL pointer
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 11 Jul 2021 12:10:48 +0000 (12:10 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 11 Jul 2021 12:10:48 +0000 (12:10 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/stringpool.c

index cb131791fcee661effb72f7f657a64e55c402186..3e2a2f8f1aa6979be03c29beeced49cf50bf235d 100644 (file)
@@ -208,6 +208,8 @@ LOC_EXPORT struct loc_stringpool* loc_stringpool_unref(struct loc_stringpool* po
 
 static off_t loc_stringpool_get_next_offset(struct loc_stringpool* pool, off_t offset) {
        const char* string = loc_stringpool_get(pool, offset);
+       if (!string)
+               return offset;
 
        return offset + strlen(string) + 1;
 }