trstr: return -1 from rstr_find() if the string is too short - neatvi - [fork] simple vi-type editor with UTF-8 support
(HTM) git clone git://src.adamsgaard.dk/neatvi
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) commit 10f95a93f415196040f45fd84924244856dcfff0
(DIR) parent 16eb081e786b544797606b0d0e8d4393c32b13ff
(HTM) Author: Ali Gholami Rudi <ali@rudi.ir>
Date: Tue, 30 Nov 2021 20:52:58 +0330
rstr: return -1 from rstr_find() if the string is too short
Diffstat:
M rstr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
(DIR) diff --git a/rstr.c b/rstr.c
t@@ -88,7 +88,7 @@ int rstr_find(struct rstr *rs, char *s, int n, int *grps, int flg)
beg = s;
end = s + strlen(s) - len - 1;
if (end < beg)
- end = beg;
+ return -1;
if (rs->lbeg)
end = beg;
if (rs->lend)