summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lib.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib.c b/lib.c
index a875d46..1d18204 100644
--- a/lib.c
+++ b/lib.c
@@ -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;
+ }
}
}