mirror of
https://github.com/tildeclub/ex-vi.git
synced 2026-06-15 01:10:17 +00:00
* Fixed an error in the realloc() function in mapmalloc.c that sometimes
caused memory to be overwritten because memcpy(new, old, size) was called with the size of 'new' if 'new' was larger than 'old'.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* September 2001.
|
||||
*/
|
||||
|
||||
/* Sccsid @(#)mapmalloc.c 1.14 (gritter) 11/26/04 */
|
||||
/* Sccsid @(#)mapmalloc.c 1.15 (gritter) 2/17/05 */
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999-2000 Ralf S. Engelschall. All rights reserved.
|
||||
@@ -508,7 +508,7 @@ realloc(char *ptr, size_t usize)
|
||||
}
|
||||
if ((vp = malloc(usize)) == NULL)
|
||||
return NULL;
|
||||
memcpy(vp, ptr, usize);
|
||||
memcpy(vp, ptr, mc->mc_usize);
|
||||
free(ptr);
|
||||
return vp;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user