mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-05 12:31:50 +01:00
Fixed blatant allocation bug.
This commit is contained in:
parent
9f8cb453b7
commit
082e84c273
@ -139,19 +139,14 @@ print_line (client_t c, const char *line)
|
|||||||
line = s + 1;
|
line = s + 1;
|
||||||
}
|
}
|
||||||
n = strlen (line);
|
n = strlen (line);
|
||||||
if (!c->buffer)
|
if (n)
|
||||||
{
|
{
|
||||||
c->size = 256 - (n + 256) % 256;
|
if (c->len + n >= c->size)
|
||||||
c->buffer = xmalloc (c->size);
|
|
||||||
memcpy (c->buffer, line, n);
|
|
||||||
c->len = n;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if (c->len + n > c->size)
|
c->size += ((n + 255) & ~255);
|
||||||
{
|
c->buffer = (c->buffer
|
||||||
c->size += 256 - (n + 256) % 256;
|
? xrealloc (c->buffer, c->size)
|
||||||
c->buffer = xrealloc (c->buffer, c->size);
|
: xmalloc (c->size));
|
||||||
}
|
}
|
||||||
memcpy (c->buffer + c->len, line, n);
|
memcpy (c->buffer + c->len, line, n);
|
||||||
c->len += n;
|
c->len += n;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user