Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F154298235
D12104.id32347.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
D12104.id32347.diff
View Options
Index: usr.sbin/makefs/mtree.c
===================================================================
--- usr.sbin/makefs/mtree.c
+++ usr.sbin/makefs/mtree.c
@@ -47,6 +47,7 @@
#include <time.h>
#include <unistd.h>
#include <util.h>
+#include <vis.h>
#include "makefs.h"
@@ -355,8 +356,6 @@
break;
case '\\':
esc++;
- if (esc == 1)
- continue;
break;
case '`':
case '\'':
@@ -401,33 +400,9 @@
fi->line++;
}
break;
- case 'a':
- if (esc)
- c = '\a';
- break;
- case 'b':
- if (esc)
- c = '\b';
- break;
- case 'f':
- if (esc)
- c = '\f';
- break;
- case 'n':
- if (esc)
- c = '\n';
- break;
- case 'r':
- if (esc)
- c = '\r';
- break;
- case 't':
- if (esc)
- c = '\t';
- break;
- case 'v':
+ default:
if (esc)
- c = '\v';
+ buf[idx++] = '\\';
break;
}
buf[idx++] = c;
@@ -591,7 +566,15 @@
error = ENOATTR;
break;
}
- node->symlink = estrdup(value);
+ node->symlink = emalloc(strlen(value) + 1);
+ if (node->symlink == NULL) {
+ error = errno;
+ break;
+ }
+ if (strunvis(node->symlink, value) < 0) {
+ error = errno;
+ break;
+ }
} else
error = ENOSYS;
break;
@@ -971,13 +954,18 @@
static int
read_mtree_spec(FILE *fp)
{
- char pathspec[PATH_MAX];
+ char pathspec[PATH_MAX], pathtmp[4*PATH_MAX + 1];
char *cp;
int error;
- error = read_word(fp, pathspec, sizeof(pathspec));
+ error = read_word(fp, pathtmp, sizeof(pathtmp));
if (error)
goto out;
+ if (strnunvis(pathspec, PATH_MAX, pathtmp) == -1) {
+ error = errno;
+ goto out;
+ }
+ error = 0;
cp = strchr(pathspec, '/');
if (cp != NULL) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 28, 4:42 PM (4 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32292487
Default Alt Text
D12104.id32347.diff (1 KB)
Attached To
Mode
D12104: Replace makefs' hand-rolled unescaping with strunvis.
Attached
Detach File
Event Timeline
Log In to Comment