nfv?asprintf are broken without va_copy, workaround them.
* drop nfasprintf. * move nfvasprintf into imap-send.c back, and let it work on a 8k buffer, and die() in case of overflow. It should be enough for imap commands, if someone cares about imap-send, he's welcomed to fix it properly. * replace nfvasprintf use in merge-recursive with a copy of the strbuf_addf logic, it's one place, we'll live with it. To ease the change, output_buffer string list is replaced with a strbuf ;) * rework trace.c to call vsnprintf itself. It's used to format strerror()s and git command names, it should never be more than a few octets long, let it work on a 8k static buffer with vsnprintf or die loudly. Signed-off-by: Pierre Habouzit <madcoder@debian.org>
This commit is contained in:

committed by
Junio C Hamano

parent
e03e05ff73
commit
19247e5510
13
imap-send.c
13
imap-send.c
@ -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 );
|
||||
|
Reference in New Issue
Block a user