summaryrefslogtreecommitdiffstats
path: root/sbin/hastd/proto_uds.c
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2010-08-05 18:27:41 +0000
committerpjd <pjd@FreeBSD.org>2010-08-05 18:27:41 +0000
commit8f25a1f5690a3220ab26f9ae74a0c54cc3a0075a (patch)
tree69593025d0867d71f06665b48ffb87e2db022f9c /sbin/hastd/proto_uds.c
parentca14b5deab70f381014e291a3b7b803c4db5c81f (diff)
downloadFreeBSD-src-8f25a1f5690a3220ab26f9ae74a0c54cc3a0075a.zip
FreeBSD-src-8f25a1f5690a3220ab26f9ae74a0c54cc3a0075a.tar.gz
Assert that various buffers we are large enough.
MFC after: 1 month
Diffstat (limited to 'sbin/hastd/proto_uds.c')
-rw-r--r--sbin/hastd/proto_uds.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sbin/hastd/proto_uds.c b/sbin/hastd/proto_uds.c
index cd72926..9c900e7 100644
--- a/sbin/hastd/proto_uds.c
+++ b/sbin/hastd/proto_uds.c
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#include "hast.h"
+#include "pjdlog.h"
#include "proto_impl.h"
#define UDS_CTX_MAGIC 0xd541c
@@ -257,15 +258,15 @@ uds_local_address(const void *ctx, char *addr, size_t size)
sunlen = sizeof(sun);
if (getsockname(uctx->uc_fd, (struct sockaddr *)&sun, &sunlen) < 0) {
- strlcpy(addr, "N/A", size);
+ PJDLOG_VERIFY(strlcpy(addr, "N/A", size) < size);
return;
}
assert(sun.sun_family == AF_UNIX);
if (sun.sun_path[0] == '\0') {
- strlcpy(addr, "N/A", size);
+ PJDLOG_VERIFY(strlcpy(addr, "N/A", size) < size);
return;
}
- snprintf(addr, size, "uds://%s", sun.sun_path);
+ PJDLOG_VERIFY(snprintf(addr, size, "uds://%s", sun.sun_path) < (ssize_t)size);
}
static void
@@ -281,12 +282,12 @@ uds_remote_address(const void *ctx, char *addr, size_t size)
sunlen = sizeof(sun);
if (getpeername(uctx->uc_fd, (struct sockaddr *)&sun, &sunlen) < 0) {
- strlcpy(addr, "N/A", size);
+ PJDLOG_VERIFY(strlcpy(addr, "N/A", size) < size);
return;
}
assert(sun.sun_family == AF_UNIX);
if (sun.sun_path[0] == '\0') {
- strlcpy(addr, "N/A", size);
+ PJDLOG_VERIFY(strlcpy(addr, "N/A", size) < size);
return;
}
snprintf(addr, size, "uds://%s", sun.sun_path);
OpenPOWER on IntegriCloud