This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: rcs 5.8-1 checks out wrong version of file when using similar mark symbols

Peter Rosin skrev 2012-03-27 10:11:
> But...careful!  You have to assume that the original authors were not
> idiots!  Maybe the obvious strcmp was not used for a *good* reason?  I
> can't tell if d->meaningful is guaranteed to be zero-terminated from the
> limited context, but it sure is suspect.  Assuming that the original
> authors were not idiots but instead made an off-by one error missing a
> corner-case, the safer approach is to replace line 11 with:
> 11:        if (!strncmp (d->meaningful, id->string, id->size + 1))
> That is, if id->string is guaranteed to be zero-terminated, which is
> not clear either, but perhaps easier to verify...

Scratch that, including the zero-terminator in the compare doesn't work
as expected if one of the strings is not zero-terminated.  But the point
still stands, don't assume the original authors were idiots, and dig
into the reasons for them to not having used strcmp from the start.


Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]