From 5d09dbd24c32039218da8bdd9ec2279b641811bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Thu, 8 Sep 2016 22:36:06 +0200 Subject: [PATCH] Replace erroneous memcpy with memmove When memory regions may overlap, memmove is required --- src/paint/map_element/surface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/paint/map_element/surface.c b/src/paint/map_element/surface.c index 224b154698..698cdf30b5 100644 --- a/src/paint/map_element/surface.c +++ b/src/paint/map_element/surface.c @@ -633,7 +633,7 @@ static void viewport_surface_draw_land_side_bottom(enum edge edge, uint8 height, // Normal walls while (curHeight > tunnelArray[0].height) { // TODO: Should probably be done by just keeping track of the current index - memcpy(&tunnelArray[0], &tunnelArray[1], sizeof(tunnel_entry) * 64); + memmove(&tunnelArray[0], &tunnelArray[1], sizeof(tunnel_entry) * 64); } if (curHeight != tunnelArray[0].height) { @@ -903,7 +903,7 @@ static void viewport_surface_draw_water_side_bottom(enum edge edge, uint8 height // Normal walls while (curHeight > tunnelArray[0].height) { // TODO: Should probably be done by just keeping track of the current index - memcpy(&tunnelArray[0], &tunnelArray[1], sizeof(tunnel_entry) * 64); + memmove(&tunnelArray[0], &tunnelArray[1], sizeof(tunnel_entry) * 64); } sub_98196C(base_image_id, offset.x, offset.y, bounds.x, bounds.y, 15, curHeight * 16, rotation); @@ -949,7 +949,7 @@ static void viewport_surface_draw_water_side_bottom(enum edge edge, uint8 height curHeight += stru_97B570[tunnelType][0]; // TODO: Should probably be done by just keeping track of the current index - memcpy(&tunnelArray[0], &tunnelArray[1], sizeof(tunnel_entry) * 64); + memmove(&tunnelArray[0], &tunnelArray[1], sizeof(tunnel_entry) * 64); } }