2007-07-11 Roland McGrath <roland@redhat.com>
* util.c (printstr): Fix size calculation for outstr allocation.
This commit is contained in:
parent
cbf406099b
commit
779c466c0f
5
util.c
5
util.c
@ -449,13 +449,14 @@ int len;
|
||||
}
|
||||
if (!str) {
|
||||
if ((str = malloc(max_strlen)) == NULL
|
||||
|| (outstr = malloc(2*max_strlen)) == NULL) {
|
||||
|| (outstr = malloc(4*max_strlen
|
||||
+ sizeof "\"\"...")) == NULL) {
|
||||
fprintf(stderr, "out of memory\n");
|
||||
tprintf("%#lx", addr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
outend = outstr + max_strlen * 2 - 10;
|
||||
outend = outstr + max_strlen * 4;
|
||||
if (len < 0) {
|
||||
n = max_strlen;
|
||||
if (umovestr(tcp, addr, n, (char *) str) < 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user