]> git.pond.sub.org Git - empserver/commitdiff
Fix recently introduced memory corrupter in path()
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 23 Aug 2008 14:42:22 +0000 (10:42 -0400)
committerMarkus Armbruster <armbru@pond.sub.org>
Wed, 27 Aug 2008 01:42:32 +0000 (21:42 -0400)
path() failed to normalize coordinate argument for deltx() and
delty().  This could subscript map[] and mapbuf[] out of bounds.
Broken in commit 3ca88271.

src/lib/commands/path.c

index dbeebbb313652e677a53dcde9a2df89a1e3e6f9d..f143a3642aad91d3761e77e046b89857c144cbf6 100644 (file)
@@ -103,8 +103,8 @@ path(void)
        memcpy(&map[delty(&ns.range, cy)][deltx(&ns.range, cx) * 2],
               routech[i][0],
               3);
-       cx += diroff[i][0];
-       cy += diroff[i][1];
+       cx = xnorm(cx + diroff[i][0]);
+       cy = ynorm(cy + diroff[i][1]);
     }
     border(&relrange, "     ", " ");
     while (nxtsct(&ns, &sect)) {