From f95c0bd7d1cc3febf21bbd38fa4b0444f22eba2c Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Thu, 15 Jul 1999 17:15:58 +0000 Subject: [PATCH] (length_int): handle the case of the largest negative integer by not calling abs git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6468 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/asn1/der_length.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/asn1/der_length.c b/lib/asn1/der_length.c index ebe65dbbe..dc9982460 100644 --- a/lib/asn1/der_length.c +++ b/lib/asn1/der_length.c @@ -59,11 +59,11 @@ length_int (int val) if (val == 0) return 1; - while (abs(val) > 255) { + while (val > 255 || val < -255) { ++ret; val /= 256; } - if (abs(val) > 0) { + if (val != 0) { ++ret; if ((signed char)val != val) ++ret;