diff --git a/contrib/bsddialog/lib/lib_util.c b/contrib/bsddialog/lib/lib_util.c --- a/contrib/bsddialog/lib/lib_util.c +++ b/contrib/bsddialog/lib/lib_util.c @@ -443,9 +443,10 @@ continue; } - if (nword + tablen >= maxwords) { + if (nword + tablen + 1 >= maxwords) { maxwords += 1024; - if (realloc(words, maxwords * sizeof(int)) == NULL) + words = realloc(words, maxwords * sizeof(int)); + if (words == NULL) RETURN_ERROR("Cannot realloc memory for text " "autosize"); } @@ -968,4 +969,4 @@ *conf->get_height = h; if (conf->get_width != NULL) *conf->get_width = w; -} \ No newline at end of file +}