summaryrefslogtreecommitdiff
path: root/src/char/int_mail.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-10-25 00:42:05 +0200
committerHaru <haru@dotalux.com>2014-10-25 00:42:05 +0200
commit3e1fe0d3842aab1c85f4dfd8e3533ca6631fc4e5 (patch)
tree91414ec9aad216e7297a700dd9bec8c08d668502 /src/char/int_mail.c
parentab3b5bd8d231434d0c3fb4db0d977e96613b4e77 (diff)
downloadhercules-3e1fe0d3842aab1c85f4dfd8e3533ca6631fc4e5.tar.gz
hercules-3e1fe0d3842aab1c85f4dfd8e3533ca6631fc4e5.tar.bz2
hercules-3e1fe0d3842aab1c85f4dfd8e3533ca6631fc4e5.tar.xz
hercules-3e1fe0d3842aab1c85f4dfd8e3533ca6631fc4e5.zip
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 <haru@dotalux.com>
Diffstat (limited to 'src/char/int_mail.c')
-rw-r--r--src/char/int_mail.c3
1 files changed, 3 insertions, 0 deletions
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;