mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-12-23 19:29:18 +00:00
Fix buffer overflow reported by Aranym people
This commit is contained in:
parent
45b2765c21
commit
2cda26edae
@ -255,7 +255,7 @@ static void build_insn (int insn)
|
|||||||
int pos = 0;
|
int pos = 0;
|
||||||
int mnp = 0;
|
int mnp = 0;
|
||||||
int bitno = 0;
|
int bitno = 0;
|
||||||
char mnemonic[10];
|
char mnemonic[64];
|
||||||
|
|
||||||
wordsizes sz = sz_long;
|
wordsizes sz = sz_long;
|
||||||
int srcgather = 0, dstgather = 0;
|
int srcgather = 0, dstgather = 0;
|
||||||
@ -332,6 +332,11 @@ static void build_insn (int insn)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
mnp++;
|
mnp++;
|
||||||
|
if ((unsigned)mnp >= sizeof(mnemonic) - 1) {
|
||||||
|
mnemonic[sizeof(mnemonic) - 1] = 0;
|
||||||
|
fprintf(stderr, "Instruction %s overflow\n", mnemonic);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user