From 12d4fbef5e5f251690cf42049b727f7bf0c38b5c Mon Sep 17 00:00:00 2001 From: christos Date: Mon, 22 Jan 2007 19:07:13 +0000 Subject: [PATCH] don't overwrite variables on the stack. From Anon Ymous. --- usr.bin/mail/format.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/usr.bin/mail/format.c b/usr.bin/mail/format.c index acdfaca7e4fa..7ccb06da8062 100644 --- a/usr.bin/mail/format.c +++ b/usr.bin/mail/format.c @@ -1,4 +1,4 @@ -/* $NetBSD: format.c,v 1.3 2006/12/10 06:06:47 christos Exp $ */ +/* $NetBSD: format.c,v 1.4 2007/01/22 19:07:13 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include #ifndef __lint__ -__RCSID("$NetBSD: format.c,v 1.3 2006/12/10 06:06:47 christos Exp $"); +__RCSID("$NetBSD: format.c,v 1.4 2007/01/22 19:07:13 christos Exp $"); #endif /* not __lint__ */ #include @@ -554,7 +554,7 @@ dateof(struct tm *tm, struct message *mp, int use_hl_date) (tail = strptime(date, " %d %b %Y %R ", tm)) != NULL)) { int hour; int min; - char sign; + char sign[2]; char *cp; if ((cp = strchr(tail, '(')) != NULL) @@ -573,9 +573,9 @@ dateof(struct tm *tm, struct message *mp, int use_hl_date) * XXX - This is painful! Is there a better way? */ if (strcmp(gmtoff, "-0000") != 0 && - sscanf(gmtoff, " %[+-]%2d%2d ", &sign, &hour, &min) == 3) { + sscanf(gmtoff, " %1[+-]%2d%2d ", sign, &hour, &min) == 3) { time_t otime; - if (sign == '-') { + if (sign[0] == '-') { tm->tm_hour += hour; tm->tm_min += min; }