diff options
-rw-r--r-- | lib.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -451,12 +451,15 @@ uc_index(uc_vm_t *vm, size_t nargs, bool right) } while (--p != sstr); } - else { + else if (nlen > 0) { p = (const char *)memmem(sstr, slen, nstr, nlen); if (p) ret = (ssize_t)(p - sstr); } + else { + ret = 0; + } } } |