diff options
author | Andy Whitcroft <apw@canonical.com> | 2010-11-01 17:01:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-11-01 17:06:00 -0400 |
commit | 020e773f6b2e797a13d23723773ed1b3ba2c35dc (patch) | |
tree | d93471ca98f605e4e453405ad3f60ab35b8b0d96 /scripts | |
parent | e99d11d19977c74b18411cdb59cdebb788237a6e (diff) |
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>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/kconfig/symbol.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index c0efe102d655..af6e9f3de950 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c | |||
@@ -875,7 +875,7 @@ const char *sym_expand_string_value(const char *in) | |||
875 | symval = sym_get_string_value(sym); | 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 | if (newlen > reslen) { | 879 | if (newlen > reslen) { |
880 | reslen = newlen; | 880 | reslen = newlen; |
881 | res = realloc(res, reslen); | 881 | res = realloc(res, reslen); |