help-libtasn1
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Use the smallest of the 2 lengths for the comparison


From: Kurt Roeckx
Subject: Re: [PATCH] Use the smallest of the 2 lengths for the comparison
Date: Mon, 28 Apr 2014 20:58:07 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

On Mon, Apr 28, 2014 at 07:22:03PM +0200, Nikos Mavrogiannopoulos wrote:
> On Mon, 2014-04-28 at 18:47 +0200, Kurt Roeckx wrote:
> 
> > It's really mostly about DER.
> > You're basicly doing 2 string compares and you'll stop comparing
> > after you see a difference or after "max" bytes because that would
> > be the smallest of the 2 strings.  If you continue after that
> > you're going to compare things you shouldn't compare anymore and
> > possible read past the end of the array.
> 
> Is it the part that says that comparison should be done assuming zero
> values in the part that exceeds one string?

Yes, and that check is done later in the code in case we come
out of the for loop and change is still -1 (no difference).

> It may be better to name the
> variable length, or something more neutral than max.

Yes.

> As it changes the
> current encoding semantics it would also be good to refer in the log
> message to the DER document paragraph that lists the new behavior (I
> assume you also read X.690).

I've been reading X.690 (and other documents) yes.  That is X.690
section 11.6.  The compare is also described in X.690 section 6.3,
which describes an alternative way of doing the same which is also
how it's implemented.


Kurt




reply via email to

[Prev in Thread] Current Thread [Next in Thread]