mirror of
https://github.com/sheumann/telnetd.git
synced 2024-11-21 09:35:33 +00:00
vasprintf: Pass a 1-character buffer to initial vsnprintf call.
GNO vsnprintf will give an error if size is 0, leading vasprintf to fail. This prevented sending data in telnetd.
This commit is contained in:
parent
7968e76e4a
commit
98b485d83b
@ -44,9 +44,10 @@ vasprintf(char **strp, const char *fmt, va_list ap)
|
||||
{
|
||||
va_list aq;
|
||||
int ret;
|
||||
char c;
|
||||
|
||||
va_copy(aq, ap);
|
||||
ret = vsnprintf(NULL, 0, fmt, ap);
|
||||
ret = vsnprintf(&c, 1, fmt, ap);
|
||||
/* va_end(ap); -- Don't do this on ORCA/C; it messes up the stack */
|
||||
if ((*strp = malloc(ret + 1)) == NULL)
|
||||
return (-1);
|
||||
|
Loading…
Reference in New Issue
Block a user