]> git.sur5r.net Git - u-boot/commit
lib: fix return codes when CONFIG_SYS_VSNPRINTF is enabled
authorDarwin Rambo <drambo@broadcom.com>
Thu, 19 Dec 2013 23:14:19 +0000 (15:14 -0800)
committerTom Rini <trini@ti.com>
Fri, 24 Jan 2014 21:59:07 +0000 (16:59 -0500)
commit686f60f519a3b06dfc4571cfb0dd832467179479
tree933c390c4edeaad27392a1396bccca8c0359a7d9
parentde351d6be6868270db21ed8a0f89d3ef703bc18e
lib: fix return codes when CONFIG_SYS_VSNPRINTF is enabled

When CONFIG_SYS_VSNPRINTF is enabled, it protects print operations
such as sprintf, snprintf, vsnprintf, etc., from buffer overflows.
But vsnprintf_internal includes the terminating NULL character in
the calculation of number of characters written. This affects sprintf
and snprintf return values. Fix this issue by setting pointer 'str'
back to the location of the '\0'.

Signed-off-by: Darwin Rambo <drambo@broadcom.com>
Reviewed-by: Steve Rae <srae@broadcom.com>
lib/vsprintf.c