From 020e773f6b2e797a13d23723773ed1b3ba2c35dc Mon Sep 17 00:00:00 2001 From: Andy Whitcroft Date: Mon, 1 Nov 2010 21:01:44 +0000 Subject: 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 Signed-off-by: Linus Torvalds --- scripts/kconfig/symbol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index c0efe102d65..af6e9f3de95 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -875,7 +875,7 @@ const char *sym_expand_string_value(const char *in) symval = sym_get_string_value(sym); } - newlen = strlen(res) + strlen(symval) + strlen(src); + newlen = strlen(res) + strlen(symval) + strlen(src) + 1; if (newlen > reslen) { reslen = newlen; res = realloc(res, reslen); -- cgit v1.2.3-18-g5258