[EMAIL PROTECTED] wrote:
Revision: 2914
Author:   aj
Date:     2006-04-26 10:08:09 +0000 (Wed, 26 Apr 2006)

Log Message:
-----------
make sure buffer is 0 terminated.

Modified Paths:
--------------
    releases/opensc-0.11.0/src/libopensc/log.c
Modified: releases/opensc-0.11.0/src/libopensc/log.c
===================================================================
--- releases/opensc-0.11.0/src/libopensc/log.c  2006-04-26 10:08:00 UTC (rev 
2913)
+++ releases/opensc-0.11.0/src/libopensc/log.c  2006-04-26 10:08:09 UTC (rev 
2914)
@@ -98,8 +98,8 @@
        }
if (file != NULL) {
-               r = snprintf(buf, sizeof(buf), "%s:%d:%s: ", file, line, func ? func : 
"");
-               if (r < 0 || (unsigned int)r > sizeof(buf))
+               r = snprintf(buf, sizeof(buf)-1, "%s:%d:%s: ", file, line, func ? func : 
"");

unless I've overlooked something I can't see a problem with the old code.
According to http://www.opengroup.org/onlinepubs/000095399/functions/printf.html
or the snprintf manpage on my system snprintf() prints at most "sizeof(buf)-1"
characters != '\0' so the old code should work ...

Cheers,
Nils
_______________________________________________
opensc-devel mailing list
[email protected]
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to