This commit is contained in:
Igor Dzuro 2020-04-02 23:47:27 +02:00
parent c513d24ba7
commit fc2c35654b
2 changed files with 12 additions and 0 deletions

Binary file not shown.

View File

@ -64,6 +64,12 @@ int main(){
} }
} else if (scanStatus == SCAN_RESULT) { } else if (scanStatus == SCAN_RESULT) {
retVal = scanValue(currentChar, &c); retVal = scanValue(currentChar, &c);
if (endChar - retVal > sizeof(char)) {
error();
break;
}
} else { } else {
error(); error();
@ -75,6 +81,12 @@ int main(){
break; break;
} else if (scanStatus == SCAN_RESULT) { } else if (scanStatus == SCAN_RESULT) {
if (operator == '/' && b == 0) {
error();
break;
}
bool validResult = evaluate(a, b, c, operator); bool validResult = evaluate(a, b, c, operator);
if (validResult == true) { if (validResult == true) {