fix potential buffer overflow while assembling

This commit is contained in:
mrbobbyguy authored and GitHub committed 2026-09-05 21:45:27 -05:00
1 parent 93b8efc591
commit ac4b764a34
1 file changed
+9
+9
View File
@@ -474,6 +474,10 @@ int assemble() {
ram.memory[instructionCount] = 0;
instructionCount++;
if (instructionCount > 0xFFFF) {
printf("Too many instructions!\n");
return -7;
}
} else if (strcmp(tokens[0], "add") == 0) {
instruction += (1 << 12);
@@ -915,6 +919,11 @@ int assemble() {
ram.memory[instructionCount] = instruction;
instructionCount++;
if (instructionCount > 0xFFFF) {
printf("Too many instructions!\n");
return -7;
}
lineCount++;
}