From ffbfe65382c8f267139b87630976700c0e80b435 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 28 Jan 2023 10:12:58 -0800 Subject: Use XtAsprintf instead of manual mallocing and copying of strings Raises minimum libXt requirement to 1.1.0 Signed-off-by: Alan Coopersmith --- Mailbox.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'Mailbox.c') diff --git a/Mailbox.c b/Mailbox.c index 9a592dd..02f28f0 100644 --- a/Mailbox.c +++ b/Mailbox.c @@ -545,14 +545,10 @@ static void GetMailFile (MailboxWidget w) } #endif if ((mailpath = getenv("MAIL"))) { - w->mailbox.filename = XtMalloc (strlen (mailpath) + 1); - strcpy (w->mailbox.filename, mailpath); + XtAsprintf(&w->mailbox.filename, "%s", mailpath); } else { - w->mailbox.filename = XtMalloc (strlen (MAILBOX_DIRECTORY) + 1 - + strlen (username) + 1); - strcpy (w->mailbox.filename, MAILBOX_DIRECTORY); - strcat (w->mailbox.filename, "/"); - strcat (w->mailbox.filename, username); + XtAsprintf(&w->mailbox.filename, "%s/%s", + MAILBOX_DIRECTORY, username); } return; } -- cgit v1.2.3