delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/03/03/09:47:56

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Dave Korn" <dave DOT korn AT artimi DOT com>
To: <cygwin AT cygwin DOT com>
Subject: RE: cygstart patch
Date: Thu, 3 Mar 2005 14:47:16 -0000
MIME-Version: 1.0
In-Reply-To: <49D88D820A7BC0479A7B0932D4219EFE1DD0EE@NAEAPAXREX04VA.nadsusea.nads.navy.mil>
Message-ID: <SERRANOwFutJLtosJ3I00000058@SERRANO.CAM.ARTIMI.COM>
X-OriginalArrivalTime: 03 Mar 2005 14:47:16.0987 (UTC) FILETIME=[E50CCCB0:01C51FFF]

----Original Message----
>From: Derosa, Anthony CIV NAVAIR 2035, 2, 205/214
>Sent: 03 March 2005 14:22

> Dave, you're right!  I was forgetting the NUL in realloc.
> I'm surprised that the original fix has been working for me.
> What do you think about Chuck's concerns regarding strcat()
> vs. strncat()?

  I thought about that as well.  I totally concur with your analysis: you've
just allocated X amount of space, based on having *measured* the size of the
X amount of data you want to copy into it; there's no way the strlen could
change in between your allocation and your string copy operation, and it
*has to be* safe.  Using strncpy adds a check of a counter with each byte
copied: but unless mathematics has suddenly stopped working and adding and
subtracting no longer give the right answers, there can't possibly be any
different result.

> So, after adding 1 to the realloc line, the patch follows
> (I *didn't* regenerate this with diff, is that OK?
> I just changed the "1" to "2" and removed some whitespace.):

  Yeh, with the cautions noted by Igor, there's no _technical_ problem: the
patch will still apply cleanly to the sources.  But there is an important
_process_ problem.  It is the number one sin of CVS to checkin anything
other than ***exactly*** the code that you compiled and tested, so you
aren't excused from having to re-compile and re-test the code with the +1 =>
+2 modification applied to it, and at that point you may as well re-generate
the diff.

   cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019