Code

Merge branch 'maint'
[git.git] / imap-send.c
index 905d09746aa36f18d873605518fbeaca25d17f73..a429a76a6385bb7d7935cfaddec9cfc8508c77e5 100644 (file)
@@ -105,6 +105,19 @@ static void free_generic_messages( message_t * );
 
 static int nfsnprintf( char *buf, int blen, const char *fmt, ... );
 
+static int nfvasprintf(char **strp, const char *fmt, va_list ap)
+{
+       int len;
+       char tmp[8192];
+
+       len = vsnprintf(tmp, sizeof(tmp), fmt, ap);
+       if (len < 0)
+               die("Fatal: Out of memory\n");
+       if (len >= sizeof(tmp))
+               die("imap command overflow !\n");
+       *strp = xmemdupz(tmp, len);
+       return len;
+}
 
 static void arc4_init( void );
 static unsigned char arc4_getbyte( void );
@@ -1167,7 +1180,7 @@ read_message( FILE *f, msg_data_t *msg )
        } while (!feof(f));
 
        msg->len  = buf.len;
-       msg->data = strbuf_detach(&buf);
+       msg->data = strbuf_detach(&buf, NULL);
        return msg->len;
 }