im.pidgin.pidgin: 94ce8a7c2dcd9c4ab8a0eff7fb4391ea043cd183
datallah at pidgin.im
datallah at pidgin.im
Sat Oct 13 13:05:36 EDT 2007
-----------------------------------------------------------------
Revision: 94ce8a7c2dcd9c4ab8a0eff7fb4391ea043cd183
Ancestor: 55c9e6a9c4728a7d3394eb9f5c6042bc0657e72d
Author: datallah at pidgin.im
Date: 2007-10-13T16:55:57
Branch: im.pidgin.pidgin
Modified files:
libpurple/util.c
ChangeLog:
Prevent invalid data length from getting passed to fwrite.
-------------- next part --------------
============================================================
--- libpurple/util.c 0d6a7ceb17774c519eafeb4f8ed824667a8fe331
+++ libpurple/util.c baf92b3583b48a3a9127280570da40090dbcaa9d
@@ -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 >= 0 || 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