From d2463a4cd8180314827fde4a1bc1bbcf048cfc77 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sat, 29 Jul 2006 11:52:54 +0000 Subject: [PATCH] work around glibc bug: printf("%.*s", INT_MAX, s) tries to allocate 2G. --- src/drv_maildir.c | 2 +- src/mdconvert.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drv_maildir.c b/src/drv_maildir.c index da869cf..7a44b70 100644 --- a/src/drv_maildir.c +++ b/src/drv_maildir.c @@ -662,7 +662,7 @@ maildir_scan( maildir_store_t *ctx, msglist_t *msglist ) if (u) ml = u - entry->base; else - ru = "", ml = INT_MAX; + ru = "", ml = sizeof(buf); fnl = nfsnprintf( buf + bl, sizeof(buf) - bl, "%s/%.*s,U=%d%s", subdirs[entry->recent], ml, entry->base, uid, ru ) + 1 - 4; memcpy( nbuf, buf, bl + 4 ); nfsnprintf( nbuf + bl + 4, sizeof(nbuf) - bl - 4, "%s", entry->base ); diff --git a/src/mdconvert.c b/src/mdconvert.c index 75fb068..9d8e623 100644 --- a/src/mdconvert.c +++ b/src/mdconvert.c @@ -154,7 +154,7 @@ convert( const char *box, int altmap ) if (u) ml = u - e->d_name; else - ru = "", ml = INT_MAX; + ru = "", ml = sizeof(buf); if (altmap) { if (!p) continue;