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: cygstart patch


----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/


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