From 826972481bd5b858c29ebf34c1939832f5d5d4c9 Mon Sep 17 00:00:00 2001 From: "Charles.Forsyth" Date: Thu, 22 May 2008 18:57:24 +0000 Subject: 20080522-1956 --- appl/lib/debug.b | 3 +++ appl/lib/msgio.b | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'appl/lib') 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"); } -- cgit v1.2.3