aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--indep.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/indep.c b/indep.c
index 4957c67..055e19e 100644
--- a/indep.c
+++ b/indep.c
@@ -104,6 +104,8 @@ allocStr(const char *s, int len)
return NULL;
if (len < 0)
len = strlen(s);
+ if (len < 0 || len >= STR_SIZE_MAX)
+ len = STR_SIZE_MAX - 1;
ptr = NewAtom_N(char, len + 1);
if (ptr == NULL) {
fprintf(stderr, "fm: Can't allocate string. Give me more memory!\n");