diff options
| author | Ian Dowse <iedowse@FreeBSD.org> | 2001-05-12 20:05:26 +0000 |
|---|---|---|
| committer | Ian Dowse <iedowse@FreeBSD.org> | 2001-05-12 20:05:26 +0000 |
| commit | 1a154a146c3d24b0bf2c23b200ca19475116f558 (patch) | |
| tree | f455661320c0e80303c47773d31409ff49438f67 /lib/libc | |
| parent | 5da751e46c992ac03537e8e65ee23e9ccd0ae4e3 (diff) | |
Notes
Diffstat (limited to 'lib/libc')
| -rw-r--r-- | lib/libc/rpc/rpc_generic.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/rpc/rpc_generic.c b/lib/libc/rpc/rpc_generic.c index 81f0b6dbb14f..ad581a5a00a6 100644 --- a/lib/libc/rpc/rpc_generic.c +++ b/lib/libc/rpc/rpc_generic.c @@ -52,6 +52,7 @@ #include <arpa/inet.h> #include <rpc/rpc.h> #include <ctype.h> +#include <stddef.h> #include <stdio.h> #include <netdb.h> #include <netconfig.h> @@ -621,8 +622,10 @@ __rpc_taddr2uaddr_af(int af, const struct netbuf *nbuf) #endif case AF_LOCAL: sun = nbuf->buf; - sun->sun_path[sizeof(sun->sun_path) - 1] = '\0'; /* safety */ - ret = strdup(sun->sun_path); + if (asprintf(&ret, "%.*s", (int)(sun->sun_len - + offsetof(struct sockaddr_un, sun_path)), + sun->sun_path) < 0) + return (NULL); break; default: return NULL; |
