Update of /cvsroot/rockbox/firmware/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31403
Modified Files:
sprintf.c
Log Message:
(v)snprintf() wrote past buffer end if string length was equal to buffer size
Index: sprintf.c
===================================================================
RCS file: /cvsroot/rockbox/firmware/common/sprintf.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- sprintf.c 24 May 2003 00:19:27 -0000 1.11
+++ sprintf.c 22 Apr 2004 21:19:33 -0000 1.12
@@ -154,7 +154,7 @@
va_end(ap);
/* make sure it ends with a trailing zero */
- pr.ptr[ok?0:-1]='\0';
+ pr.ptr[(pr.bytes < pr.max) ? 0 : -1] = '\0';
return pr.bytes;
}
@@ -171,7 +171,7 @@
ok = format(sprfunc, &pr, fmt, ap);
/* make sure it ends with a trailing zero */
- pr.ptr[ok?0:-1]='\0';
+ pr.ptr[(pr.bytes < pr.max) ? 0 : -1] = '\0';
return pr.bytes;
}
_______________________________________________
http://cool.haxx.se/mailman/listinfo/rockbox-cvs
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|