On Thu, 2011-02-10 at 14:34 +0100, Olaf van der Spek wrote: > On Thu, Feb 10, 2011 at 2:29 PM, Eduardo Silva <[email protected]> > wrote: > >> > There's strlcpy, but it's not in glibc because of possible truncation > >> > errors! > >> > >> Then use a private wrapper. > >> > > > > Here's the new patch: > > > > ---- > > [PATCH] Add safe string manipulation functions > > > > Deprecate direct use of strcpy(3) > > The following string manipulation function has been added: > > > > - string_copy() : wrapper of strcpy(3) > > - string_ncopy(): wrapper of strncpy(3) > > > > both function compose safe NULL terminated strings. > > ---- > > > > I check that the code most of the time raise an error if the path is too > > long, so the new wrappers should be ok... > > string_copy seems pointless, it's kinda equivalent to strcpy.
got your point, but If we are creating wrappers for string manipulation, let's do it for the most common functions used. > if (!dest || !src) should include an assert so it's easier to break in > the debugger. > good one regards, Ed.- -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
