Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107070217
D44514.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D44514.diff
View Options
diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c
--- a/usr.bin/xinstall/xinstall.c
+++ b/usr.bin/xinstall/xinstall.c
@@ -1529,15 +1529,18 @@
static const char extra[] = { ' ', '\t', '\n', '\\', '#', '\0' };
const char *p;
char *buf;
- size_t destlen;
+ size_t buflen, destlen;
struct flock metalog_lock;
if (!metafp)
return;
- /* Buffer for strsvis(3). */
- buf = (char *)malloc(4 * strlen(path) + 1);
- if (buf == NULL) {
- warnx("%s", strerror(ENOMEM));
+ /* Buffer for strsnvis(3), used for both path and slink. */
+ buflen = strlen(path);
+ if (slink && strlen(slink) > buflen)
+ buflen = strlen(slink);
+ buflen = 4 * buflen + 1;
+ if ((buf = malloc(buflen)) == NULL) {
+ warn(NULL);
return;
}
@@ -1562,7 +1565,7 @@
}
while (*p && *p == '/')
p++;
- strsvis(buf, p, VIS_OCTAL, extra);
+ strsnvis(buf, buflen, p, VIS_OCTAL, extra);
p = buf;
/* Print details. */
fprintf(metafp, ".%s%s type=%s", *p ? "/" : "", p, type);
@@ -1572,14 +1575,14 @@
fprintf(metafp, " gname=%s", group);
fprintf(metafp, " mode=%#o", mode);
if (slink) {
- strsvis(buf, slink, VIS_CSTYLE, extra); /* encode link */
+ strsnvis(buf, buflen, slink, VIS_CSTYLE, extra);
fprintf(metafp, " link=%s", buf);
}
if (*type == 'f') /* type=file */
fprintf(metafp, " size=%lld", (long long)size);
if (ts != NULL && dopreserve)
fprintf(metafp, " time=%lld.%09ld",
- (long long)ts[1].tv_sec, ts[1].tv_nsec);
+ (long long)ts[1].tv_sec, ts[1].tv_nsec);
if (digestresult && digest)
fprintf(metafp, " %s=%s", digest, digestresult);
if (fflags)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 10, 3:42 PM (14 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15743840
Default Alt Text
D44514.diff (1 KB)
Attached To
Mode
D44514: install: Prefer strsnvis() to strsvis().
Attached
Detach File
Event Timeline
Log In to Comment