提交 020e773f 编写于 作者: A Andy Whitcroft 提交者: Linus Torvalds

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: NAndy Whitcroft <apw@canonical.com>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 e99d11d1
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册