commit e4745e4f94d2a1f0fd2c273d87a834d3348cd2c8
parent 45381de834ddc6df6cd3dd7435561222b01d75d0
Author: phoebos <ben@bvnf.space>
Date: Mon, 6 Jun 2022 10:38:25 +0100
uxnsolve: check that address isn't too small
negative addresses would be interpreted by sed as a flag.
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/uxnsolve b/uxnsolve
@@ -32,6 +32,11 @@ dec_address="$(printf "16iAo%s 100-p\n" "$address" | dc || kill 0)"
# add 1 because the zeroth byte is on the first line
dec_address="$((dec_address + 1))"
+[ "$dec_address" -lt 0 ] && {
+ printf "address %s is in zero page, don't subtract 0x0100\n" "$address"
+ exit 1
+}
+
is_integer() {
printf %d "$1" >/dev/null 2>&1
}