[Pcsclite-cvs-commit] r5849 - /trunk/PCSC/src/debuglog.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Wed Jul 6 19:56:56 UTC 2011
Author: rousseau
Date: Wed Jul 6 19:56:56 2011
New Revision: 5849
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5849
Log:
log_xxd_always(): use safer snprintf() instead of sprintf()
coverity: Event secure_coding: [VERY RISKY]. Using "sprintf" can cause a
buffer overflow when done incorrectly. Because sprintf() assumes an
arbitrarily long string, callers must be careful not to overflow the
actual space of the destination. Use snprintf() instead, or correct
precision specifiers.
Modified:
trunk/PCSC/src/debuglog.c
Modified: trunk/PCSC/src/debuglog.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/debuglog.c?rev=5849&op=diff
==============================================================================
--- trunk/PCSC/src/debuglog.c (original)
+++ trunk/PCSC/src/debuglog.c Wed Jul 6 19:56:56 2011
@@ -188,7 +188,8 @@
for (i = 0; (i < len) && (c < debug_buf_end); ++i)
{
- sprintf(c, "%02X ", buffer[i]);
+ /* 2 hex characters, 1 space, 1 NUL : total 4 characters */
+ snprintf(c, 4, "%02X ", buffer[i]);
c += 3;
}
More information about the Pcsclite-cvs-commit
mailing list