diff options
Diffstat (limited to 'src/core/misc.c')
-rw-r--r-- | src/core/misc.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/misc.c b/src/core/misc.c index 9115f29a..37e6a001 100644 --- a/src/core/misc.c +++ b/src/core/misc.c @@ -307,8 +307,10 @@ char *stristr(const char *data, const char *key) keylen = strlen(key); datalen = strlen(data); - if (keylen > datalen || keylen == 0) + if (keylen > datalen) return NULL; + if (keylen == 0) + return (char *) data; max = data+datalen-keylen; pos = 0; @@ -339,8 +341,10 @@ char *stristr_full(const char *data, const char *key) keylen = strlen(key); datalen = strlen(data); - if (keylen > datalen || keylen == 0) + if (keylen > datalen) return NULL; + if (keylen == 0) + return (char *) data; max = data+datalen-keylen; start = data; pos = 0; |