libCom: Fix buggy pointer dereference in postfix()

This commit is contained in:
Jeremy Lorelli authored and Michael Davidsaver committed 2023-09-26 09:52:13 -07:00
1 parent 88ea1507f4
commit 60fa2d31da
2 files changed
+11 -1

No files matched your search

+8
View File
@@ -335,6 +335,10 @@ LIBCOM_API long
break;
case SEPERATOR:
if (pstacktop == stack) {
*perror = CALC_ERR_BAD_SEPERATOR;
goto bad;
}
/* Move operators to the output until open paren */
while (pstacktop->name[0] != '(') {
if (pstacktop <= stack+1) {
@@ -353,6 +357,10 @@ LIBCOM_API long
break;
case CLOSE_PAREN:
if (pstacktop == stack) {
*perror = CALC_ERR_PAREN_NOT_OPEN;
goto bad;
}
/* Move operators to the output until matching paren */
while (pstacktop->name[0] != '(') {
if (pstacktop <= stack+1) {