]> granicus.if.org Git - nethack/commitdiff
Prevent out of array index
authorPasi Kallinen <paxed@alt.org>
Wed, 7 Nov 2018 16:39:00 +0000 (18:39 +0200)
committerPasi Kallinen <paxed@alt.org>
Wed, 7 Nov 2018 16:39:00 +0000 (18:39 +0200)
src/sp_lev.c

index 11d6925014ba20004ed4911bb58ade537bfc5de6..488a04d87d47e55bb6b92075367dee678d6cc3c7 100644 (file)
@@ -3912,9 +3912,9 @@ int n;
     xchar xx = (xchar) x, yy = (xchar) y;
 
     while (n > 0) {
+        --n;
         if (xs[n] == xx && ys[n] == yy)
             return TRUE;
-        --n;
     }
     return FALSE;
 }