From: Bobby Durrett Date: Mon, 6 Jun 2016 04:10:26 +0000 (-0700) Subject: Fix crash with MAIL env variable X-Git-Tag: NetHack-3.6.1_RC01~666^2^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1c8f312fb6bbe2f8096d9ebdaa63e006aa052b54;p=nethack Fix crash with MAIL env variable --- diff --git a/src/mail.c b/src/mail.c index 06ce1b266..82c7c0925 100644 --- a/src/mail.c +++ b/src/mail.c @@ -90,7 +90,12 @@ free_maildata() void getmailstatus() { - if (!mailbox && !(mailbox = nh_getenv("MAIL"))) { + char *emailbox; + if (emailbox = nh_getenv("MAIL")) { + mailbox = (char *) alloc((unsigned) strlen(emailbox)); + Strcpy(mailbox, emailbox); + } + if (!mailbox) { #ifdef MAILPATH #ifdef AMS struct passwd ppasswd;