summaryrefslogtreecommitdiff
path: root/usr/src/lib/cfgadm_plugins
diff options
context:
space:
mode:
authorsethg <none@none>2006-10-30 18:54:11 -0800
committersethg <none@none>2006-10-30 18:54:11 -0800
commitd3080269c400bce011f72255205cee37b5b04079 (patch)
tree93ad56ff587d0c654c4cecca5120de8e265e22c3 /usr/src/lib/cfgadm_plugins
parent952478be9ba2d4a2c49ce2a5d681f1ae4f608674 (diff)
downloadillumos-joyent-d3080269c400bce011f72255205cee37b5b04079.tar.gz
6487426 sata plugin induces segfaults when run on a diskless client over NFSv2
Diffstat (limited to 'usr/src/lib/cfgadm_plugins')
-rw-r--r--usr/src/lib/cfgadm_plugins/sata/common/cfga_sata.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr/src/lib/cfgadm_plugins/sata/common/cfga_sata.c b/usr/src/lib/cfgadm_plugins/sata/common/cfga_sata.c
index 0973818b28..9c245e9bd8 100644
--- a/usr/src/lib/cfgadm_plugins/sata/common/cfga_sata.c
+++ b/usr/src/lib/cfgadm_plugins/sata/common/cfga_sata.c
@@ -280,7 +280,8 @@ physpath_to_devlink(const char *basedir, const char *node_path,
buf = malloc(PATH_MAX);
real_path = malloc(PATH_MAX);
- deplen = pathconf(basedir, _PC_NAME_MAX) +
+ deplen = pathconf(basedir, _PC_NAME_MAX);
+ deplen = (deplen <= 0 ? MAXNAMELEN : deplen) +
sizeof (struct dirent);
dep = (struct dirent *)malloc(deplen);
@@ -1185,7 +1186,8 @@ sata_make_dyncomp(const char *ap_id, char **dyncomp)
* struct dirent includes one byte (the terminator)
* so we don't add 1 to the calculation here.
*/
- deplen = pathconf(devpath, _PC_NAME_MAX) +
+ deplen = pathconf(devpath, _PC_NAME_MAX);
+ deplen = ((deplen <= 0) ? MAXNAMELEN : deplen) +
sizeof (struct dirent);
dep = (struct dirent *)malloc(deplen);
if (dep == NULL)