From: Adam Dickmeiss Date: Tue, 21 Oct 2003 09:30:32 +0000 (+0000) Subject: Flag zero-zero as error in completeBER X-Git-Tag: YAZ.2.0.5.pre2~9 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=2e0cefa8b248dafdbc6518d12d0ba646d2f19565;p=yaz-moved-to-github.git Flag zero-zero as error in completeBER --- diff --git a/odr/ber_any.c b/odr/ber_any.c index 376d121..73f8dfb 100644 --- a/odr/ber_any.c +++ b/odr/ber_any.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2003, Index Data * See the file LICENSE for details. * - * $Id: ber_any.c,v 1.26 2003-10-20 13:44:05 adam Exp $ + * $Id: ber_any.c,v 1.27 2003-10-21 09:30:32 adam Exp $ */ #if HAVE_CONFIG_H #include @@ -56,10 +56,10 @@ int completeBER_n(const unsigned char *buf, int len, int level) if (level > 1000) return -2; } - if (!len) + if (len < 2) return 0; if (!buf[0] && !buf[1]) - return 0; + return -2; if ((res = ber_dectag(b, &zclass, &tag, &cons, len)) <= 0) return 0; #if 0 @@ -129,7 +129,7 @@ int completeBER_n(const unsigned char *buf, int len, int level) /* constructed - cycle through children */ while (len >= 2) { - if (*b == 0 && *(b + 1) == 0) + if (b[0] == 0 && b[1] == 0) break; if (!(res = completeBER_n(b, len, level+1))) return 0;