From 3e1fe0d3842aab1c85f4dfd8e3533ca6631fc4e5 Mon Sep 17 00:00:00 2001 From: Haru Date: Sat, 25 Oct 2014 00:42:05 +0200 Subject: Added some missing variable initializations - The issue was caused by memcmp failing because of garbage in structs padding. - Fixes bugreport:8410, special thanks (and credits for the fix) to Garr http://hercules.ws/board/tracker/issue-8410-autotradeat-issue/ - Also reduced scope of some variables, where appropriate. - Thanks to Ind. Signed-off-by: Haru --- src/char/int_mail.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/char/int_mail.c') diff --git a/src/char/int_mail.c b/src/char/int_mail.c index 86a36d59f..47d2cc1c5 100644 --- a/src/char/int_mail.c +++ b/src/char/int_mail.c @@ -148,6 +148,7 @@ static bool mail_loadmessage(int mail_id, struct mail_message* msg) { int j; StringBuf buf; + memset(msg, 0, sizeof(struct mail_message)); // Initialize data StrBuf->Init(&buf); StrBuf->AppendStr(&buf, "SELECT `id`,`send_name`,`send_id`,`dest_name`,`dest_id`,`title`,`message`,`time`,`status`," @@ -206,6 +207,7 @@ static bool mail_loadmessage(int mail_id, struct mail_message* msg) static void mapif_Mail_sendinbox(int fd, int char_id, unsigned char flag) { struct mail_data md; + memset(&md, 0, sizeof(md)); mail_fromsql(char_id, &md); //FIXME: dumping the whole structure like this is unsafe [ultramage] @@ -262,6 +264,7 @@ static bool mail_DeleteAttach(int mail_id) static void mapif_Mail_getattach(int fd, int char_id, int mail_id) { struct mail_message msg; + memset(&msg, 0, sizeof(msg)); if( !mail_loadmessage(mail_id, &msg) ) return; -- cgit v1.2.3-70-g09d2