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

Jeroen Ruigrok/asmodai asmodai at crater.dragonflybsd.org
Sun Sep 18 06:24:20 PDT 2005


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





More information about the Commits mailing list