aboutsummaryrefslogtreecommitdiffstats
path: root/Str.c
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2021-03-04 14:46:21 +0000
committerTatsuya Kinoshita <tats@debian.org>2021-03-04 14:46:21 +0000
commit13015ebcf62aeeeddc298710c7cd889281f49844 (patch)
tree9f57b956de7323137e3942da7840e0ec4d8d7e5b /Str.c
parentUpdate ChangeLog (diff)
downloadw3m-13015ebcf62aeeeddc298710c7cd889281f49844.tar.gz
w3m-13015ebcf62aeeeddc298710c7cd889281f49844.zip
Prevent unneeded Strgrow in Strinsert_char
Diffstat (limited to 'Str.c')
-rw-r--r--Str.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Str.c b/Str.c
index b4f1360..464b5a7 100644
--- a/Str.c
+++ b/Str.c
@@ -348,7 +348,7 @@ Strinsert_char(Str s, int pos, char c)
{
int i;
STR_LENGTH_CHECK(s);
- if (pos < 0)
+ if (pos < 0 || s->length < pos)
return;
if (s->length + 2 > s->area_size)
Strgrow(s);