im.pidgin.pidgin: 2a6a07744921317ab43ace2c71d306af571c60f6
rlaager at pidgin.im
rlaager at pidgin.im
Sun Jan 13 23:22:23 EST 2008
-----------------------------------------------------------------
Revision: 2a6a07744921317ab43ace2c71d306af571c60f6
Ancestor: 42fd8dbdb3b01eba75306887b372141f3bada0fc
Author: rlaager at pidgin.im
Date: 2008-01-13T21:15:04
Branch: im.pidgin.pidgin
Modified files:
libpurple/protocols/qq/file_trans.c
ChangeLog:
Part of a large patch from o_sukhodolsky to fix some build warnings.
Refs #1344
I changed this somewhat. If someone cares about QQ, they should really
fix the TODO I noted here.
-------------- next part --------------
============================================================
--- libpurple/protocols/qq/file_trans.c f5194733f32cb969cf43a87dc1579b60c688b35d
+++ libpurple/protocols/qq/file_trans.c c07f767a88ac2ed8eba476e440885c922c8226e8
@@ -97,6 +97,7 @@ static void _fill_file_md5(const gchar *
guint8 *buffer;
PurpleCipher *cipher;
PurpleCipherContext *context;
+ size_t wc;
const gint QQ_MAX_FILE_MD5_LENGTH = 10002432;
@@ -109,15 +110,20 @@ static void _fill_file_md5(const gchar *
buffer = g_newa(guint8, filelen);
g_return_if_fail(buffer != NULL);
- fread(buffer, filelen, 1, fp);
+ wc = fread(buffer, filelen, 1, fp);
+ fclose(fp);
+ if (wc != 1) {
+ purple_debug_error("qq", "Unable to read file: %s\n", filename);
+ /* TODO: XXX: Really, the caller should be modified to deal with this properly. */
+ return;
+ }
+
cipher = purple_ciphers_find_cipher("md5");
context = purple_cipher_context_new(cipher, NULL);
purple_cipher_context_append(context, buffer, filelen);
purple_cipher_context_digest(context, 16, md5, NULL);
purple_cipher_context_destroy(context);
-
- fclose(fp);
}
static void _qq_get_file_header(guint8 *buf, guint8 **cursor, gint buflen, qq_file_header *fh)
More information about the Commits
mailing list