make urldb internal parse macros less prone to control flow errors

fixes issue highlighted by coverity (CID 1361696)
This commit is contained in:
Vincent Sanders 2017-03-05 12:11:48 +00:00
parent ca942e9e26
commit 718da3ffff

View File

@ -3796,7 +3796,7 @@ void urldb_load_cookies(const char *filename)
if (!fp) if (!fp)
return; return;
#define FIND_T { \ #define FIND_T do { \
for (; *p && *p != '\t'; p++) \ for (; *p && *p != '\t'; p++) \
; /* do nothing */ \ ; /* do nothing */ \
if (p >= end) { \ if (p >= end) { \
@ -3804,16 +3804,16 @@ void urldb_load_cookies(const char *filename)
continue; \ continue; \
} \ } \
*p++ = '\0'; \ *p++ = '\0'; \
} } while(0)
#define SKIP_T { \ #define SKIP_T do { \
for (; *p && *p == '\t'; p++) \ for (; *p && *p == '\t'; p++) \
; /* do nothing */ \ ; /* do nothing */ \
if (p >= end) { \ if (p >= end) { \
LOG("Overran input"); \ LOG("Overran input"); \
continue; \ continue; \
} \ } \
} } while(0)
while (fgets(s, sizeof s, fp)) { while (fgets(s, sizeof s, fp)) {
char *p = s, *end = 0, char *p = s, *end = 0,