Displaying 6 results from an estimated 6 matches for "sstrdup".
Did you mean:
strdup
2019 Jan 25
0
[klibc:update-dash] [EVAL] Fix use-after-free in dotrap/evalstring
...sr/dash/histedit.c | 3 +--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/usr/dash/eval.c b/usr/dash/eval.c
index da39136d..755136e2 100644
--- a/usr/dash/eval.c
+++ b/usr/dash/eval.c
@@ -160,6 +160,7 @@ evalstring(char *s, int flags)
struct stackmark smark;
int status;
+ s = sstrdup(s);
setinputstring(s);
setstackmark(&smark);
@@ -171,7 +172,9 @@ evalstring(char *s, int flags)
if (evalskip)
break;
}
+ popstackmark(&smark);
popfile();
+ stunalloc(s);
return status;
}
diff --git a/usr/dash/histedit.c b/usr/dash/histedit.c
index b27d6294..94465d78 10...
2020 Mar 28
0
[klibc:update-dash] dash: [EVAL] Fix use-after-free in dotrap/evalstring
...sr/dash/histedit.c | 3 +--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/usr/dash/eval.c b/usr/dash/eval.c
index e6f6cd5c..adf05fde 100644
--- a/usr/dash/eval.c
+++ b/usr/dash/eval.c
@@ -160,6 +160,7 @@ evalstring(char *s, int flags)
struct stackmark smark;
int status;
+ s = sstrdup(s);
setinputstring(s);
setstackmark(&smark);
@@ -171,7 +172,9 @@ evalstring(char *s, int flags)
if (evalskip)
break;
}
+ popstackmark(&smark);
popfile();
+ stunalloc(s);
return status;
}
diff --git a/usr/dash/histedit.c b/usr/dash/histedit.c
index b27d6294..94465d78 10...
2019 Jan 25
0
[klibc:update-dash] [CD] support drive letters on Cygwin
...includes a function that
+ forces normalization to the posix form */
+ char pathbuf[PATH_MAX];
+ if (cygwin_conv_path(CCP_WIN_A_TO_POSIX | CCP_RELATIVE, dir, pathbuf,
+ sizeof(pathbuf)) < 0)
+ sh_error("can't normalize %s", dir);
+ dir = pathbuf;
+#endif
+
cdcomppath = sstrdup(dir);
STARTSTACKSTR(new);
if (*dir != '/') {
2020 Mar 28
0
[klibc:update-dash] dash: [CD] support drive letters on Cygwin
...includes a function that
+ forces normalization to the posix form */
+ char pathbuf[PATH_MAX];
+ if (cygwin_conv_path(CCP_WIN_A_TO_POSIX | CCP_RELATIVE, dir, pathbuf,
+ sizeof(pathbuf)) < 0)
+ sh_error("can't normalize %s", dir);
+ dir = pathbuf;
+#endif
+
cdcomppath = sstrdup(dir);
STARTSTACKSTR(new);
if (*dir != '/') {
2019 Jan 25
0
[klibc:update-dash] builtin: Fix handling of trailing IFS white spaces
...{
struct arglist arglist;
struct strlist *sl;
- char *backup;
- char *line;
- /* ifsbreakup will fiddle with stack region... */
- line = stackblock();
s = grabstackstr(s);
- /* need a copy, so that delimiters aren't lost
- * in case there are more fields than variables */
- backup = sstrdup(line);
-
arglist.lastp = &arglist.list;
- ifsbreakup(s, &arglist);
+ ifsbreakup(s, ac, &arglist);
*arglist.lastp = NULL;
ifsfree();
@@ -105,21 +98,6 @@ readcmd_handle_line(char *s, char **ap)
return;
}
- /* remaining fields present, but no variables left. */
- if (!...
2020 Mar 28
0
[klibc:update-dash] dash: builtin: Fix handling of trailing IFS white spaces
...{
struct arglist arglist;
struct strlist *sl;
- char *backup;
- char *line;
- /* ifsbreakup will fiddle with stack region... */
- line = stackblock();
s = grabstackstr(s);
- /* need a copy, so that delimiters aren't lost
- * in case there are more fields than variables */
- backup = sstrdup(line);
-
arglist.lastp = &arglist.list;
- ifsbreakup(s, &arglist);
+ ifsbreakup(s, ac, &arglist);
*arglist.lastp = NULL;
ifsfree();
@@ -105,21 +98,6 @@ readcmd_handle_line(char *s, char **ap)
return;
}
- /* remaining fields present, but no variables left. */
- if (!...