[lkml]   [2003]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH 2.6]: IPv6: strcpy -> strlcpy
    In article <> (at Thu, 27 Nov 2003 20:00:41 +0000), Russell King <> says:

    > The thing that worries me is that an incorrect strlcpy() conversion
    > gives the impression that someone has thought about buffer underruns
    > as well as overruns, and, unless someone /has/ actually thought about
    > it, there could well still be a security problem lurking there.

    Hmm, what do you actually mean by "buffer underruns?"

    (If I'm correct) do you suggest that we should zero-out rest of
    destination buffer?

    if so, we may want to have a function, say strlcpy0(), like this:

    size_t strlcpy0(char *dst, const char *src, size_t maxlen)
    size_t len = strlcpy(dst, src, maxlen);
    if (maxlen && len < maxlen - 1)
    memset(dst + len + 1, 0, maxlen - len - 1);
    return len;

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:58    [W:0.021 / U:2.596 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site