1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-21 20:38:45 +00:00

Add -3 to len as room for \n\r\0

This commit is contained in:
Andrey A. Chernov 1998-06-27 20:47:27 +00:00
parent dbf926fd90
commit 2ab4aaac95
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=11565

View File

@ -28,14 +28,14 @@
if (format)
#ifdef HAVE_VPRINTF
- vsprintf(mp,format,ap);
+ vsnprintf(mp,len,format,ap);
+ vsnprintf(mp,len-3,format,ap);
#else
# ifdef PYRAMID
- (void)sprintf(mp,format, arg1, arg2, arg3, arg4, arg5, arg6);
+ (void)snprintf(mp,len,format, arg1, arg2, arg3, arg4, arg5, arg6);
+ (void)snprintf(mp,len-3,format, arg1, arg2, arg3, arg4, arg5, arg6);
# else
- (void)sprintf(mp,format,((int *)ap)[0],((int *)ap)[1],((int *)ap)[2],
+ (void)snprintf(mp,len,format,((int *)ap)[0],((int *)ap)[1],((int *)ap)[2],
+ (void)snprintf(mp,len-3,format,((int *)ap)[0],((int *)ap)[1],((int *)ap)[2],
((int *)ap)[3],((int *)ap)[4]);
# endif
#endif