git.samba.org
/
ira
/
wip.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
9b5d1e9
)
tsocket_bsd: return -1 and set errno to ENAMETOOLONG if the unix path is too long
author
Stefan Metzmacher
<metze@samba.org>
Tue, 3 Nov 2009 16:23:07 +0000
(17:23 +0100)
committer
Stefan Metzmacher
<metze@samba.org>
Tue, 3 Nov 2009 17:24:44 +0000
(18:24 +0100)
metze
lib/tsocket/tsocket_bsd.c
patch
|
blob
|
history
diff --git
a/lib/tsocket/tsocket_bsd.c
b/lib/tsocket/tsocket_bsd.c
index 8f1ccbeb432251b048636494cc2e18e4a3ba9305..05f5be19cbed225cf66b7d4011772c043479c6c8 100644
(file)
--- a/
lib/tsocket/tsocket_bsd.c
+++ b/
lib/tsocket/tsocket_bsd.c
@@
-444,9
+444,14
@@
int _tsocket_address_unix_from_path(TALLOC_CTX *mem_ctx,
path = "";
}
+ if (strlen(path) > sizeof(un.sun_path)-1) {
+ errno = ENAMETOOLONG;
+ return -1;
+ }
+
ZERO_STRUCT(un);
un.sun_family = AF_UNIX;
- strncpy(un.sun_path, path, sizeof(un.sun_path));
+ strncpy(un.sun_path, path, sizeof(un.sun_path)
-1
);
ret = _tsocket_address_bsd_from_sockaddr(mem_ctx,
(struct sockaddr *)p,