/soc/2012/sanket/statscollector-2.x.y: b19ca66d3342: [BUG] NULL ...
Sanket Agarwal
sanket at soc.pidgin.im
Tue Jul 10 00:36:26 EDT 2012
Changeset: b19ca66d33427fdf02a8e2c1691408917acb3790
Author: Sanket Agarwal <sanket at soc.pidgin.im>
Date: 2012-06-02 11:39 +0000
Branch: soc.2012.statscollector
URL: http://hg.pidgin.im/soc/2012/sanket/statscollector-2.x.y/rev/b19ca66d3342
Description:
[BUG] NULL terminate the rand_md5 string
There is a bug that rand_md5 string is *not* NULL terminated, and hence
it picks up data after the string which makes the HASH inconsistent while
printing. Simply, NULL terminate the string to that purpose.
diffstat:
libpurple/plugins/statscollector.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diffs (21 lines):
diff --git a/libpurple/plugins/statscollector.c b/libpurple/plugins/statscollector.c
--- a/libpurple/plugins/statscollector.c
+++ b/libpurple/plugins/statscollector.c
@@ -80,7 +80,7 @@
g_get_current_time(&time);
/* Creates a random MD5 (16bytes) string */
- rand_str = (char *)g_new0(char, 16*2);
+ rand_str = (char *)g_new0(char, 16*2+1);
/* Initialize the seed */
srand(time.tv_sec * time.tv_usec);
@@ -90,6 +90,8 @@
rand_str[i] = e[rand()%16];
}
+ rand_str[i] = '\0';
+
return rand_str;
}
More information about the Commits
mailing list