(doit): check return values from snprintf being negative

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10652 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2001-09-04 09:45:52 +00:00
parent 0fa47f785f
commit be5fe4842b

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997-2000 Kungliga Tekniska H<>gskolan
* Copyright (c) 1997-2001 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -208,7 +208,7 @@ doit(int s,
{
int ret;
char out_buf[PUSH_BUFSIZ];
size_t out_len = 0;
int out_len = 0;
char in_buf[PUSH_BUFSIZ + 1]; /* sentinel */
size_t in_len = 0;
char *in_ptr = in_buf;
@@ -262,6 +262,8 @@ doit(int s,
out_len = snprintf (out_buf, sizeof(out_buf),
"USER %s\r\nPASS hej\r\nSTAT\r\n",
user);
if (out_len < 0)
errx (1, "snprintf failed");
if (net_write (s, out_buf, out_len) != out_len)
err (1, "write");
if (verbose > 1)
@@ -464,6 +466,8 @@ doit(int s,
else if(state == DELE)
out_len = snprintf (out_buf, sizeof(out_buf),
"DELE %u\r\n", ++asked_deleted);
if (out_len < 0)
errx (1, "snprintf failed");
if (net_write (s, out_buf, out_len) != out_len)
err (1, "write");
if (verbose > 1)