summaryrefslogtreecommitdiff
path: root/usr/src/lib/libproc/common
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2019-12-03 12:37:33 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2019-12-03 12:37:33 +0000
commit1e3614d0308cc53fe5630084af9ef8719a9c44a8 (patch)
treea783e76bfac006395d41cf5b28d40c568b075c78 /usr/src/lib/libproc/common
parent98860832862cef20612fd5b10b324f5eba1b4015 (diff)
parentb8dc1b43d204b714c2fda8dd4efd67de0c671db6 (diff)
downloadillumos-joyent-1e3614d0308cc53fe5630084af9ef8719a9c44a8.tar.gz
[illumos-gate merge]
commit b8dc1b43d204b714c2fda8dd4efd67de0c671db6 11945 pool import performance regression due to repeated libshare initialization commit 69d9b1c5b0824b6e4feadaf289d68d945f0fbe6f 11984 libproc: passing argument 2 to restrict-qualified parameter aliases with argument 1 commit ec38b3f5fb92a39a55897ec0e3e4eeb0e84fefcc 12036 iscsi: zpool create pool fails to create label commit c54162e4540c6b4eb112c199658a34287d2dc971 12018 loader.efi: efipart needs better support detecting nested partitions
Diffstat (limited to 'usr/src/lib/libproc/common')
-rw-r--r--usr/src/lib/libproc/common/Pzone.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr/src/lib/libproc/common/Pzone.c b/usr/src/lib/libproc/common/Pzone.c
index 3c4999bbe4..d2562a2a79 100644
--- a/usr/src/lib/libproc/common/Pzone.c
+++ b/usr/src/lib/libproc/common/Pzone.c
@@ -795,9 +795,14 @@ Pfindmap(struct ps_prochandle *P, map_info_t *mptr, char *s, size_t n)
/* Try /proc first to get the real object name */
if ((Pstate(P) != PS_DEAD) && (mptr->map_pmap.pr_mapname[0] != '\0')) {
- (void) snprintf(buf, sizeof (buf), "%s/%d/path/%s",
+ char path[PATH_MAX];
+
+ len = snprintf(path, sizeof (path), "%s/%d/path/%s",
procfs_path, (int)P->pid, mptr->map_pmap.pr_mapname);
- if ((len = readlink(buf, buf, sizeof (buf))) > 0) {
+ if (len < 0 || (size_t)len >= sizeof (path))
+ return (NULL);
+
+ if ((len = readlink(path, buf, sizeof (buf))) > 0) {
buf[len] = '\0';
(void) Plofspath(buf, buf, sizeof (buf));
(void) strlcpy(s, buf, n);