aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);