DragonFly BSD
DragonFly commits List (threaded) for 2005-09
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

cvs commit: src/lib/libc/gen basename.c


From: Jeroen Ruigrok/asmodai <asmodai@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 18 Sep 2005 06:21:13 -0700 (PDT)

asmodai     2005/09/18 06:21:13 PDT

DragonFly src repository

  Modified files:
    lib/libc/gen         basename.c 
  Log:
  Fix long standing logic bug in basename() introduced in 1.4.
  
  We do not want to copy MAXPATHLEN/sizeof(bname) with strlcpy() since that will
  happily copy ANY trailing slash, negating the entire pointer arithmatic of
  endp and startp above.
  Instead, reinstate endp - startp as size parameter to the copy function.
  However, normally where a + 1 would be needed to solve the outcome, we now need
  + 2 due to strlcpy() only copying *size - 1*.
  
  Revision  Changes    Path
  1.6       +1 -1      src/lib/libc/gen/basename.c


http://www.dragonflybsd.org/cvsweb/src/lib/libc/gen/basename.c.diff?r1=1.5&r2=1.6&f=u



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