commit a1bc00ce5f4a78672717ad8193d5d2426a34d778
parent 4e68dc775325f647ba2bd7cadc975226ddc7c3c2
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date: Sat, 7 Jan 2023 11:59:00 -0800
(uxnasm) Fixed buffer overflow in tokenizer
Diffstat:
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/build.sh b/build.sh
@@ -115,7 +115,7 @@ echo "Assembling(asma).."
if [ $norun = 1 ]; then exit; fi
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.."
./bin/uxnemu bin/piano.rom
diff --git a/src/uxn.c b/src/uxn.c
@@ -32,8 +32,8 @@ WITH REGARD TO THIS SOFTWARE.
int
uxn_eval(Uxn *u, Uint16 pc)
{
- Uint16 a, b, c, j, k, bs, instr;
Uint8 kptr, *sp;
+ Uint16 a, b, c, j, k, bs, instr;
Stack *src, *dst;
if(!pc || u->dev[0x0f]) return 0;
while((instr = u->ram[pc++])) {
diff --git a/src/uxnasm.c b/src/uxnasm.c
@@ -416,9 +416,9 @@ assemble(FILE *f)
{
char w[0x40];
scpy("on-reset", p.scope, 0x40);
- while(fscanf(f, "%63s", w) == 1)
- if(!parse(w, f))
- return error("Unknown token", w);
+ while(fscanf(f, "%62s", w) == 1)
+ if(slen(w) > 0x3d || !parse(w, f))
+ return error("Invalid token", w);
return resolve();
}