Thread (16 messages) 16 messages, 6 authors, 2011-02-11

Re: [PATCH] Btrfs-progs use safe string manipulation functions

From: Olaf van der Spek <hidden>
Date: 2011-02-10 13:34:57

On Thu, Feb 10, 2011 at 2:29 PM, Eduardo Silva <eduardo.silva@oracle.co=
m> wrote:
quoted
quoted
There's strlcpy, but it's not in glibc because of possible truncat=
ion
quoted
quoted
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:

=C2=A0 - string_copy() : wrapper of strcpy(3)
=C2=A0 - 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.
if (!dest || !src) should include an assert so it's easier to break in
the debugger.

--=20
Olaf
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help