catch when snprint needs a larger buffer
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14850 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -268,11 +268,13 @@ doit(int s,
|
|||||||
now = time(NULL);
|
now = time(NULL);
|
||||||
from_line_length = snprintf (from_line, sizeof(from_line),
|
from_line_length = snprintf (from_line, sizeof(from_line),
|
||||||
"From %s %s", "push", ctime(&now));
|
"From %s %s", "push", ctime(&now));
|
||||||
|
if (from_line_length < 0 || from_line_length > sizeof(from_line))
|
||||||
|
errx (1, "snprintf failed");
|
||||||
|
|
||||||
out_len = snprintf (out_buf, sizeof(out_buf),
|
out_len = snprintf (out_buf, sizeof(out_buf),
|
||||||
"USER %s\r\nPASS hej\r\nSTAT\r\n",
|
"USER %s\r\nPASS hej\r\nSTAT\r\n",
|
||||||
user);
|
user);
|
||||||
if (out_len < 0)
|
if (out_len < 0 || out_len > sizeof(out_buf))
|
||||||
errx (1, "snprintf failed");
|
errx (1, "snprintf failed");
|
||||||
if (net_write (s, out_buf, out_len) != out_len)
|
if (net_write (s, out_buf, out_len) != out_len)
|
||||||
err (1, "write");
|
err (1, "write");
|
||||||
@@ -490,7 +492,7 @@ doit(int s,
|
|||||||
else if(state == DELE)
|
else if(state == DELE)
|
||||||
out_len = snprintf (out_buf, sizeof(out_buf),
|
out_len = snprintf (out_buf, sizeof(out_buf),
|
||||||
"DELE %u\r\n", ++asked_deleted);
|
"DELE %u\r\n", ++asked_deleted);
|
||||||
if (out_len < 0)
|
if (out_len < 0 || out_len > sizeof(out_buf))
|
||||||
errx (1, "snprintf failed");
|
errx (1, "snprintf failed");
|
||||||
if (net_write (s, out_buf, out_len) != out_len)
|
if (net_write (s, out_buf, out_len) != out_len)
|
||||||
err (1, "write");
|
err (1, "write");
|
||||||
|
Reference in New Issue
Block a user