X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Message-ID: <4F72D956.50009@lysator.liu.se> Date: Wed, 28 Mar 2012 11:26:46 +0200 From: Peter Rosin User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120312 Thunderbird/11.0 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: rcs 5.8-1 checks out wrong version of file when using similar mark symbols References: <4F717637 DOT 80703 AT lysator DOT liu DOT se> <4F71791C DOT 8010707 AT lysator DOT liu DOT se> <20120328065524 DOT GA27483 AT phoenix> In-Reply-To: <20120328065524.GA27483@phoenix> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Gary Johnson skrev 2012-03-28 08:55: > On 2012-03-27, Peter Rosin wrote: >> 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. > > I don't know, the "original" authors seem to have gotten it right, > as version 5.7 works correctly on my Fedora system, and the function > in question was added between versions 5.7 and 5.8. What are you trying to say here? That whoever it was that brought rcs from 5.7 to 5.8 are a bunch of idiots? I'm sure not, but that's what it sounds like... Cheech, I just said that it looked suspect that strcmp was not used from the start and that someone needed to look at the code and double- check if strlen/strcmp was safe to use before running full-steam into a segfault. So, go look at the code. I just did, and the suggested changes are indeed broken since the id string is *not* guaranteed to be zero- terminated. It appears that the original authors (of 5.8 of course, that's the version we are discussing) are not idiots, since you can neither use strlen on the id string nor can you use strcmp on it. However, it seems as if d->meaningful is zero-terminated (as far as I can tell strcmp, via the STR_SAME macro, is used on it at other locations in the code). So, this is probably safe for line 11: if ((strlen(d->meaningful) == id->size) && !strncmp(d->meaningful, id->string, id->size)) If d->meaningful is not guaranteed to be zero-terminated, this bug is not fixable from within rev_from_symbol(). Cheers, Peter -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple