diff options
author | Mike Zeller <mike@mikezeller.net> | 2020-04-30 12:05:53 -0400 |
---|---|---|
committer | Mike Zeller <mike@mikezeller.net> | 2020-04-30 12:05:53 -0400 |
commit | ac392c47376cdb46e02be40735cc74d5d100fe6c (patch) | |
tree | 450ea4b694961d00606485aa323234bb2ad69851 /usr/src/lib/libzonecfg | |
parent | 95a46e0bd62ba0e68db9fa0b958dc5313920e6fe (diff) | |
parent | 0f8413a98e7949bf0a6a2c24153f2928c7eb5cfb (diff) | |
download | illumos-joyent-OS-8165.tar.gz |
Merge branch 'master' into OS-8165OS-8165
Diffstat (limited to 'usr/src/lib/libzonecfg')
-rw-r--r-- | usr/src/lib/libzonecfg/common/libzonecfg.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/usr/src/lib/libzonecfg/common/libzonecfg.c b/usr/src/lib/libzonecfg/common/libzonecfg.c index e709b7dba8..7dc3f9ccb8 100644 --- a/usr/src/lib/libzonecfg/common/libzonecfg.c +++ b/usr/src/lib/libzonecfg/common/libzonecfg.c @@ -6066,9 +6066,16 @@ new_zone_did() int len; int val; struct flock lck; + char pathbuf[PATH_MAX]; char buf[80]; - if ((fd = open(DEBUGID_FILE, O_RDWR | O_CREAT, + if (snprintf(pathbuf, sizeof (pathbuf), "%s%s", zonecfg_get_root(), + DEBUGID_FILE) >= sizeof (pathbuf)) { + printf(gettext("alternate root path is too long")); + return (-1); + } + + if ((fd = open(pathbuf, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0) { perror("new_zone_did open failed"); return (-1); |