b5801b
diff --git a/common/parse.c b/common/parse.c
b5801b
index e78223c2..656b378b 100644
b5801b
--- a/common/parse.c
b5801b
+++ b/common/parse.c
b5801b
@@ -5790,13 +5790,14 @@ int parse_X (cfile, buf, max)
b5801b
 				skip_to_semi (cfile);
b5801b
 				return 0;
b5801b
 			}
b5801b
-			convert_num (cfile, &buf [len], val, 16, 8);
b5801b
-			if (len++ > max) {
b5801b
+			if (len >= max) {
b5801b
 				parse_warn (cfile,
b5801b
 					    "hexadecimal constant too long.");
b5801b
 				skip_to_semi (cfile);
b5801b
 				return 0;
b5801b
 			}
b5801b
+			convert_num (cfile, &buf [len], val, 16, 8);
b5801b
+			len++;
b5801b
 			token = peek_token (&val, (unsigned *)0, cfile);
b5801b
 			if (token == COLON)
b5801b
 				token = next_token (&val,