X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=odr%2Fber_bool.c;h=7ce8dc266d6d80ebfae036d7716dfc8de03c6602;hb=8bccad6217bd2ba078106a531a9e73e7f3aae4a9;hp=20a8a35ca8917300f916ed0a2368a8c7141bd8e3;hpb=4d531a1a9131d69c3b6c27fbac42837e22cff61c;p=yaz-moved-to-github.git diff --git a/odr/ber_bool.c b/odr/ber_bool.c index 20a8a35..7ce8dc2 100644 --- a/odr/ber_bool.c +++ b/odr/ber_bool.c @@ -3,7 +3,7 @@ * See the file LICENSE for details. * Sebastian Hammer, Adam Dickmeiss * - * $Id: ber_bool.c,v 1.13 2003-01-06 08:20:27 adam Exp $ + * $Id: ber_bool.c,v 1.14 2003-03-11 11:03:31 adam Exp $ */ #if HAVE_CONFIG_H @@ -29,17 +29,17 @@ int ber_boolean(ODR o, int *val) #endif return 1; case ODR_DECODE: - if ((res = ber_declen(o->bp, &len)) < 0) + if ((res = ber_declen(o->bp, &len, odr_max(o))) < 0) { - o->error = OPROTO; + odr_seterror(o, OPROTO, 9); return 0; } - if (len != 1) + o->bp+= res; + if (len != 1 || odr_max(o) < len) { - o->error = OPROTO; + odr_seterror(o, OPROTO, 10); return 0; } - o->bp+= res; *val = *o->bp; o->bp++; #ifdef ODR_DEBUG @@ -48,6 +48,6 @@ int ber_boolean(ODR o, int *val) return 1; case ODR_PRINT: return 1; - default: o->error = OOTHER; return 0; + default: odr_seterror(o, OOTHER, 11); return 0; } }