Skip to content

Commit 348f63a

Browse files
authored
Merge pull request #4 from sjinks/master
[master] Fix memory leak and buffer overrun
2 parents 6c5a665 + e56fea5 commit 348f63a

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

parser/scanner.re

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -599,39 +599,39 @@ int xx_get_token(xx_scanner_state *s, xx_scanner_token *token) {
599599
}
600600
q = YYCURSOR;
601601

602-
if (token->len > 3) {
602+
if (token->len > 3 && token->value[0] == '_') {
603603

604-
if (!memcmp(token->value, "_GET", sizeof("_GET")-1)) {
604+
if (!strcmp(token->value, "_GET")) {
605605
token->opcode = XX_T_IDENTIFIER;
606606
return 0;
607607
}
608608

609-
if (!memcmp(token->value, "_POST", sizeof("_POST")-1)) {
609+
if (!strcmp(token->value, "_POST")) {
610610
token->opcode = XX_T_IDENTIFIER;
611611
return 0;
612612
}
613613

614-
if (!memcmp(token->value, "_REQUEST", sizeof("_REQUEST")-1)) {
614+
if (!strcmp(token->value, "_REQUEST")) {
615615
token->opcode = XX_T_IDENTIFIER;
616616
return 0;
617617
}
618618

619-
if (!memcmp(token->value, "_COOKIE", sizeof("_COOKIE")-1)) {
619+
if (!strcmp(token->value, "_COOKIE")) {
620620
token->opcode = XX_T_IDENTIFIER;
621621
return 0;
622622
}
623623

624-
if (!memcmp(token->value, "_SERVER", sizeof("_SERVER")-1)) {
624+
if (!strcmp(token->value, "_SERVER")) {
625625
token->opcode = XX_T_IDENTIFIER;
626626
return 0;
627627
}
628628

629-
if (!memcmp(token->value, "_SESSION", sizeof("_SESSION")-1)) {
629+
if (!strcmp(token->value, "_SESSION")) {
630630
token->opcode = XX_T_IDENTIFIER;
631631
return 0;
632632
}
633633

634-
if (!memcmp(token->value, "_FILES", sizeof("_FILES")-1)) {
634+
if (!strcmp(token->value, "_FILES")) {
635635
token->opcode = XX_T_IDENTIFIER;
636636
return 0;
637637
}

zephir_parser.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ PHP_FUNCTION(zephir_parse_file)
6363
}
6464
RETURN_ZVAL(&ret, 1, 1);
6565
#else
66-
RETVAL_ZVAL(ret, 1, 0);
66+
RETVAL_ZVAL(ret, 1, 1);
6767
#endif
6868
}
6969
/* }}} */

0 commit comments

Comments
 (0)