提交 038b04d8 编写于 作者: S Stephan

Take out len from condition check.

Otherwise, the check is just undefined behaviour. gcc even takes out
this check because len can never be zero if len does not wrap around.

Found with -Wstrict-overflow=2
上级 624bc851
......@@ -712,8 +712,9 @@ static char *print_string_ptr(const char *str, printbuffer *p)
ptr = str;
/* calculate additional space that is needed for escaping */
while ((token = *ptr) && ++len)
while ((token = *ptr))
{
++len;
if (strchr("\"\\\b\f\n\r\t", token))
{
len++; /* +1 for the backslash */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册