im.pidgin.pidgin: 99cf68a5d3604fa8f1e05918e5b370a6a4991cd1

datallah at pidgin.im datallah at pidgin.im
Sat Oct 13 13:25:44 EDT 2007


-----------------------------------------------------------------
Revision: 99cf68a5d3604fa8f1e05918e5b370a6a4991cd1
Ancestor: 7d6d68e181cad51516162cb1ccf769a1204c4688
Author: datallah at pidgin.im
Date: 2007-10-13T17:23:40
Branch: im.pidgin.pidgin

Modified files:
        libpurple/util.c

ChangeLog: 

nosnilmot points out that this is a better way to ensure the size is valid.

-------------- next part --------------
============================================================
--- libpurple/util.c	0d6a7ceb17774c519eafeb4f8ed824667a8fe331
+++ libpurple/util.c	bb614dd45ec36a524a1e2d62568d5cac522d2c93
@@ -2565,6 +2565,8 @@ purple_util_write_data_to_file_absolute(
 	purple_debug_info("util", "Writing file %s\n",
 					filename_full);
 
+	g_return_val_if_fail((size >= -1), FALSE);
+
 	filename_temp = g_strdup_printf("%s.save", filename_full);
 
 	/* Remove an old temporary file, if one exists */
@@ -2590,7 +2592,7 @@ purple_util_write_data_to_file_absolute(
 	}
 
 	/* Write to file */
-	real_size = (size == -1) ? strlen(data) : size;
+	real_size = (size == -1) ? strlen(data) : (size_t) size;
 	byteswritten = fwrite(data, 1, real_size, file);
 
 	/* Close file */


More information about the Commits mailing list