Mercurial > pidgin
changeset 16903:11a0f2b4ac83
If the read() in resolved() fails, we should detect the failure and set size (which it would otherwise set, since it is passed by reference) to 0 and res to NULL. This ''may'' fix a rather odd crash described in Adium Trac #6623 (http://trac.adiumx.com/ticket/6623), and it is certainly good sanity checking.
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Sat, 05 May 2007 18:29:49 +0000 |
parents | f9e7a7dacda3 |
children | 56042b2f8b64 d177369ce625 ba47cfaa013b |
files | libpurple/dnssrv.c |
diffstat | 1 files changed, 13 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/dnssrv.c Sat May 05 18:14:48 2007 +0000 +++ b/libpurple/dnssrv.c Sat May 05 18:29:49 2007 +0000 @@ -192,11 +192,19 @@ PurpleSrvCallback cb = query_data->cb; int status; - read(source, &size, sizeof(int)); - purple_debug_info("dnssrv","found %d SRV entries\n", size); - tmp = res = g_new0(PurpleSrvResponse, size); - for (i = 0; i < size; i++) { - read(source, tmp++, sizeof(PurpleSrvResponse)); + if (read(source, &size, sizeof(int)) > 0) + { + purple_debug_info("dnssrv","found %d SRV entries\n", size); + tmp = res = g_new0(PurpleSrvResponse, size); + for (i = 0; i < size; i++) { + read(source, tmp++, sizeof(PurpleSrvResponse)); + } + } + else + { + purple_debug_info("dnssrv","found 0 SRV entries; errno is %i\n", errno); + size = 0; + res = NULL; } cb(res, size, query_data->extradata);