diff options
| author | Hideaki Yoshifuji <yoshfuji@linux-ipv6.org> | 2005-03-30 00:35:41 -0800 |
|---|---|---|
| committer | David S. Miller <davem@sunset.davemloft.net> | 2005-03-30 00:35:41 -0800 |
| commit | 4f57d2511a796c775352f587a86f2cfc989bfcfc (patch) | |
| tree | ad27a8f407c64aa007c0279c428b09a7fb886aa4 /net/unix/af_unix.c | |
| parent | cc027ceedf3f8afe63d1296c9c99453e033c806f (diff) | |
[AF_UNIX]: unix_mkname comment
Resurrect an old comment, explaining why this isn't an off-by-one error.
Signed-off-by: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/unix/af_unix.c')
| -rw-r--r-- | net/unix/af_unix.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 0768f8814759..20165335e27b 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -188,6 +188,13 @@ static int unix_mkname(struct sockaddr_un * sunaddr, int len, unsigned *hashp) if (!sunaddr || sunaddr->sun_family != AF_UNIX) return -EINVAL; if (sunaddr->sun_path[0]) { + /* + * This may look like an off by one error but it is a bit more + * subtle. 108 is the longest valid AF_UNIX path for a binding. + * sun_path[108] doesnt as such exist. However in kernel space + * we are guaranteed that it is a valid memory location in our + * kernel address buffer. + */ ((char *)sunaddr)[len]=0; len = strlen(sunaddr->sun_path)+1+sizeof(short); return len; |
