diff options
author | JP Rosevear <jpr@helixcode.com> | 2000-08-22 03:56:14 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2000-08-22 03:56:14 +0800 |
commit | b1161811db7b81206fe5991472130ae8237e321d (patch) | |
tree | 9a0e363f36552990b1ac64d5e1e84e14d8bc28ee /camel/providers/nntp | |
parent | c415597aa45aa1954e32771b6841ced41c55c2cb (diff) | |
download | gsoc2013-evolution-b1161811db7b81206fe5991472130ae8237e321d.tar gsoc2013-evolution-b1161811db7b81206fe5991472130ae8237e321d.tar.gz gsoc2013-evolution-b1161811db7b81206fe5991472130ae8237e321d.tar.bz2 gsoc2013-evolution-b1161811db7b81206fe5991472130ae8237e321d.tar.lz gsoc2013-evolution-b1161811db7b81206fe5991472130ae8237e321d.tar.xz gsoc2013-evolution-b1161811db7b81206fe5991472130ae8237e321d.tar.zst gsoc2013-evolution-b1161811db7b81206fe5991472130ae8237e321d.zip |
Make sure respbuffer is not null before manipulating it. If it is null,
2000-08-21 JP Rosevear <jpr@helixcode.com>
* providers/nntp/camel-nntp-store.c (camel_nntp_command):
Make sure respbuffer is not null before manipulating it.
If it is null, return CAMEL_NNTP_FAIL and a decent error
message.
svn path=/trunk/; revision=4906
Diffstat (limited to 'camel/providers/nntp')
-rw-r--r-- | camel/providers/nntp/camel-nntp-store.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c index 45b1fdee04..74952015a4 100644 --- a/camel/providers/nntp/camel-nntp-store.c +++ b/camel/providers/nntp/camel-nntp-store.c @@ -292,22 +292,29 @@ camel_nntp_command (CamelNNTPStore *store, char **ret, char *fmt, ...) /* Read the response */ respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (store->istream)); - resp_code = atoi (respbuf); + if (!respbuf) { + if (ret) + *ret = g_strdup (g_strerror (errno)); + return CAMEL_NNTP_FAIL; + } + + resp_code = atoi (respbuf); + if (resp_code < 400) status = CAMEL_NNTP_OK; else if (resp_code < 500) status = CAMEL_NNTP_ERR; else status = CAMEL_NNTP_FAIL; - + if (ret) { *ret = strchr (respbuf, ' '); if (*ret) *ret = g_strdup (*ret + 1); } g_free (respbuf); - + return status; } |