summaryrefslogtreecommitdiff
path: root/appl
diff options
context:
space:
mode:
Diffstat (limited to 'appl')
-rw-r--r--appl/lib/debug.b3
-rw-r--r--appl/lib/msgio.b2
2 files changed, 4 insertions, 1 deletions
diff --git a/appl/lib/debug.b b/appl/lib/debug.b
index 5e479274..44d77100 100644
--- a/appl/lib/debug.b
+++ b/appl/lib/debug.b
@@ -921,6 +921,9 @@ pstring(p: ref Prog, a: int): (int, string, string)
(n, s, err) = pstring0(p, a, m);
if(err != "" || n <= len s)
break;
+ # guard against broken devprog
+ if(m >= 3 * n)
+ return (-1, nil, "bad string");
m *= 2;
}
return (n, s, err);
diff --git a/appl/lib/msgio.b b/appl/lib/msgio.b
index 035b1783..65ce6017 100644
--- a/appl/lib/msgio.b
+++ b/appl/lib/msgio.b
@@ -89,7 +89,7 @@ getbuf(fd: ref Sys->FD, buf: array of byte, n: int): (int, string)
}
if(buf[0] == byte 0)
return (n, nil);
- if(buf[0] == byte 16rFF){
+ if(buf[0] != byte 16rFF){
# garbled, possibly the wrong encryption
return (-1, "failure");
}