kconfig: sym_expand_string_value: allow for string termination when reallocing

When expanding a parameterised string we may run out of space, this
triggers a realloc. When computing the new allocation size we do not
allow for the terminating '\0'. Allow for this when calculating the new
length.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Andy Whitcroft and committed by
Linus Torvalds
020e773f e99d11d1

+1 -1
+1 -1
scripts/kconfig/symbol.c
··· 875 875 symval = sym_get_string_value(sym); 876 876 } 877 877 878 - newlen = strlen(res) + strlen(symval) + strlen(src); 878 + newlen = strlen(res) + strlen(symval) + strlen(src) + 1; 879 879 if (newlen > reslen) { 880 880 reslen = newlen; 881 881 res = realloc(res, reslen);