0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-27 00:03:00 +00:00

(uxnasm) Fixed buffer overflow in tokenizer

This commit is contained in:
Devine Lu Linvega 2023-01-07 11:59:00 -08:00
parent 4e68dc7753
commit a1bc00ce5f
3 changed files with 5 additions and 5 deletions

View file

@ -115,7 +115,7 @@ echo "Assembling(asma).."
if [ $norun = 1 ]; then exit; fi if [ $norun = 1 ]; then exit; fi
echo "Assembling(piano).." echo "Assembling(piano).."
./bin/uxnasm projects/software/piano.tal bin/piano.rom 2> bin/piano.log ./bin/uxnasm projects/software/piano.tal bin/piano.rom
echo "Running.." echo "Running.."
./bin/uxnemu bin/piano.rom ./bin/uxnemu bin/piano.rom

View file

@ -32,8 +32,8 @@ WITH REGARD TO THIS SOFTWARE.
int int
uxn_eval(Uxn *u, Uint16 pc) uxn_eval(Uxn *u, Uint16 pc)
{ {
Uint16 a, b, c, j, k, bs, instr;
Uint8 kptr, *sp; Uint8 kptr, *sp;
Uint16 a, b, c, j, k, bs, instr;
Stack *src, *dst; Stack *src, *dst;
if(!pc || u->dev[0x0f]) return 0; if(!pc || u->dev[0x0f]) return 0;
while((instr = u->ram[pc++])) { while((instr = u->ram[pc++])) {

View file

@ -416,9 +416,9 @@ assemble(FILE *f)
{ {
char w[0x40]; char w[0x40];
scpy("on-reset", p.scope, 0x40); scpy("on-reset", p.scope, 0x40);
while(fscanf(f, "%63s", w) == 1) while(fscanf(f, "%62s", w) == 1)
if(!parse(w, f)) if(slen(w) > 0x3d || !parse(w, f))
return error("Unknown token", w); return error("Invalid token", w);
return resolve(); return resolve();
} }