[Pcsclite-cvs-commit] r6009 - /trunk/PCSC/src/spy/pcsc-spy.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Fri Oct 7 10:14:26 UTC 2011


Author: rousseau
Date: Fri Oct  7 10:14:25 2011
New Revision: 6009

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=6009
Log:
spy_line(): Emergency exit if the buffer is too small

The line is limited to 256 characters. Dumping a buffer of more than
256/3 = 85 bytes wil overflow the line buffer.

Modified:
    trunk/PCSC/src/spy/pcsc-spy.c

Modified: trunk/PCSC/src/spy/pcsc-spy.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/spy/pcsc-spy.c?rev=6009&op=diff
==============================================================================
--- trunk/PCSC/src/spy/pcsc-spy.c (original)
+++ trunk/PCSC/src/spy/pcsc-spy.c Fri Oct  7 10:14:25 2011
@@ -158,6 +158,11 @@
 
 	va_start(args, fmt);
 	size = vsnprintf(line, sizeof line, fmt, args);
+	if ((size_t)size >= sizeof line)
+	{
+		printf("Buffer is too small. Exiting!\n");
+		exit(-1);
+	}
 	write(Log_fd, line, size);
 	write(Log_fd, "\n", 1);
 	va_end(args);




More information about the Pcsclite-cvs-commit mailing list