Displaying 4 results from an estimated 4 matches for "stunalloc".
Did you mean:
stuballoc
2020 Mar 28
0
[klibc:update-dash] dash: exec: Do not allocate stack string in padvance
...e ((cmdname = padvance(&path, argv[0])) != NULL) {
+ while (padvance(&path, argv[0]) >= 0) {
+ cmdname = stackblock();
if (--idx < 0 && pathopt == NULL) {
tryexec(cmdname, argv, envp);
if (errno != ENOENT && errno != ENOTDIR)
e = errno;
}
- stunalloc(cmdname);
}
}
@@ -182,8 +182,7 @@ repeat:
const char *pathopt;
-char *
-padvance(const char **path, const char *name)
+int padvance(const char **path, const char *name)
{
const char *p;
char *q;
@@ -191,7 +190,7 @@ padvance(const char **path, const char *name)
size_t len;
if...
2019 Jan 25
0
[klibc:update-dash] [EVAL] Fix use-after-free in dotrap/evalstring
...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 100644
--- a/usr/dash/histedit.c
+++ b/usr/dash/histedit.c
@@ -372,8 +372,7 @@ histcmd(int argc, char **argv)
out2str(s);
}
- evalstring(strcpy(stalloc(strlen(s) + 1), s),
-...
2020 Mar 28
0
[klibc:update-dash] dash: [EVAL] Fix use-after-free in dotrap/evalstring
...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 100644
--- a/usr/dash/histedit.c
+++ b/usr/dash/histedit.c
@@ -372,8 +372,7 @@ histcmd(int argc, char **argv)
out2str(s);
}
- evalstring(strcpy(stalloc(strlen(s) + 1), s),
-...
2020 Mar 28
0
[klibc:update-dash] dash: memalloc: Avoid looping in growstackto
...e (stackblocksize() < len)
- growstackblock();
-
+ if (stackblocksize() < len)
+ growstackblock(len);
return stackblock();
}
diff --git a/usr/dash/memalloc.h b/usr/dash/memalloc.h
index b348d9cc..b9c63dac 100644
--- a/usr/dash/memalloc.h
+++ b/usr/dash/memalloc.h
@@ -55,7 +55,6 @@ void stunalloc(pointer);
void pushstackmark(struct stackmark *mark, size_t len);
void setstackmark(struct stackmark *);
void popstackmark(struct stackmark *);
-void growstackblock(void);
void *growstackstr(void);
char *growstackto(size_t len);
char *makestrspace(size_t, char *);