Fix parsing of illegal drops from PGN
[xboard.git] / parser.c
index 481e7b2..d60b833 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -87,7 +87,7 @@ SkipWhite (char **p)
     return *p != start;
 }
 
-inline int
+static inline int
 Match (char *pattern, char **ptr)
 {
     char *p = pattern, *s = *ptr;
@@ -99,7 +99,7 @@ Match (char *pattern, char **ptr)
     return 0; // no match, no ptr update
 }
 
-inline int
+static inline int
 Word (char *pattern, char **p)
 {
     if(Match(pattern, p)) return 1;
@@ -267,6 +267,7 @@ NextUnit (char **p)
                fromY = DROP_RANK; fromX = cl.pieceIn;
                currentMoveString[0] = piece;
                currentMoveString[1] = '@';
+               currentMoveString[4] = NULLCHAR;
                return LegalityTest(boards[yyboardindex], PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, fromY, fromX, toY, toX, NULLCHAR);
            }
            if(type[1] == NOTHING && type[0] != NOTHING) { // there is a disambiguator