From 2e0cefa8b248dafdbc6518d12d0ba646d2f19565 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 21 Oct 2003 09:30:32 +0000 Subject: [PATCH] Flag zero-zero as error in completeBER --- odr/ber_any.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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; -- 1.7.10.4