Skip to content
Snippets Groups Projects
Commit e7a381f1 authored by rswindell's avatar rswindell
Browse files

MSCRTL implementation of vsnprintf() returns -1 on overflow (output truncated).

parent 4112b744
No related branches found
No related tags found
No related merge requests found
......@@ -284,9 +284,7 @@ static int sockprintf(SOCKET sock, char *fmt, ...)
len=vsnprintf(sbuf,maxlen=sizeof(sbuf)-2,fmt,argptr);
va_end(argptr);
if(len<0) /* format error? */
return(0);
if(len>maxlen) /* output truncated */
if(len<0 || len>maxlen) /* format error or output truncated */
len=maxlen;
if(startup!=NULL && startup->options&FTP_OPT_DEBUG_TX)
lprintf(LOG_DEBUG,"%04d TX: %.*s", sock, len, sbuf);
......
......@@ -247,9 +247,7 @@ int sockprintf(SOCKET sock, char *fmt, ...)
len=vsnprintf(sbuf,maxlen=sizeof(sbuf)-2,fmt,argptr);
va_end(argptr);
if(len<0) /* format error? */
return(0);
if(len>maxlen) /* output truncated */
if(len<0 || len > maxlen) /* format error or output truncated */
len=maxlen;
if(startup->options&MAIL_OPT_DEBUG_TX)
lprintf(LOG_DEBUG,"%04d TX: %.*s", sock, len, sbuf);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment