X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fgenstamp.c;h=737b3fa54ebd8fdfaa8535329527776f2d0f617e;hb=f781bc87eeff269e5d570e0d9ecf14efac980cf4;hp=cfbb8bbb6c7ef16a378ba042e9a1d0d37c097b7e;hpb=971a2a6395d1c5fb418f3e2b64ef5213089e6255;p=citadel.git diff --git a/citadel/genstamp.c b/citadel/genstamp.c index cfbb8bbb6..737b3fa54 100644 --- a/citadel/genstamp.c +++ b/citadel/genstamp.c @@ -44,7 +44,7 @@ static char *weekdays[] = { * Supplied with a unix timestamp, generate an RFC822-compliant textual * time and date stamp. */ -void datestring(char *buf, time_t xtime, int which_format) { +void datestring(char *buf, size_t n, time_t xtime, int which_format) { struct tm *t; long offset; @@ -70,7 +70,7 @@ void datestring(char *buf, time_t xtime, int which_format) { switch(which_format) { case DATESTRING_RFC822: - sprintf(buf, "%s, %02d %s %04d %02d:%02d:%02d %c%04ld", + snprintf(buf, n, "%s, %02d %s %04d %02d:%02d:%02d %c%04ld", weekdays[t->tm_wday], t->tm_mday, months[t->tm_mon], @@ -83,7 +83,7 @@ void datestring(char *buf, time_t xtime, int which_format) { break; case DATESTRING_IMAP: - sprintf(buf, "%02d-%s-%04d %02d:%02d:%02d %c%04ld", + snprintf(buf, n, "%02d-%s-%04d %02d:%02d:%02d %c%04ld", t->tm_mday, months[t->tm_mon], t->tm_year + 1900,