[syslinux] com32's realloc function
Kenneth Fyfe
kenfyfe at conkersoft.co.uk
Sat Jan 14 15:51:59 PST 2006
Hello list,
I've been playing with com32 programs lately and I've come across a
a problem with the realloc function in libcom32. The code that rounds
up the size looks to be missing a '~' operator, resulting in it
truncating every request to a size of 0-15 bytes.
The little patch below fixes it up to match the corresponding line in
malloc, which makes it work for me.
K.
diff -u /tmp/syslinux-3.11/com32/lib/realloc.c syslinux-3.11/com32/lib/realloc.c
--- /tmp/syslinux-3.11/com32/lib/realloc.c 2004-11-10 22:31:50.000000000 +0000
+++ syslinux-3.11/com32/lib/realloc.c 2006-01-14 23:37:52.000000000 +0000
@@ -24,7 +24,7 @@
}
/* Add the obligatory arena header, and round up */
- size = (size+2*sizeof(struct arena_header)-1) & ARENA_SIZE_MASK;
+ size = (size+2*sizeof(struct arena_header)-1) & ~ARENA_SIZE_MASK;
ah = (struct free_arena_header *)
((struct arena_header *)ptr - 1);
More information about the Syslinux
mailing list