mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-04 03:11:28 +00:00
Fix for #7819: Properly trim \n on rarun2 envfile
Newline characters are not properly removed when reading env vars from envfile of a rarun2 profile. Although tempted to to use `r_str_trim_tail`, manual trimming is used instead in order to disrupt env vars as little as possible for funky cases such as when including shellcodes, etc...
This commit is contained in:
parent
c1cb93aaf8
commit
42836cb353
@ -449,6 +449,7 @@ R_API bool r_run_parseline (RRunProfile *p, char *b) {
|
||||
}
|
||||
} else if (!strcmp (b, "envfile")) {
|
||||
char *p, buf[1024];
|
||||
size_t len;
|
||||
FILE *fd = fopen (e, "r");
|
||||
if (!fd) {
|
||||
eprintf ("Cannot open '%s'\n", e);
|
||||
@ -464,8 +465,11 @@ R_API bool r_run_parseline (RRunProfile *p, char *b) {
|
||||
}
|
||||
p = strchr (buf, '=');
|
||||
if (p) {
|
||||
*p = 0;
|
||||
r_sys_setenv (buf, p + 1);
|
||||
*p++ = 0;
|
||||
len = strlen(p);
|
||||
if (p[len-1] == '\n') p[len-1] = 0;
|
||||
if (p[len-2] == '\r') p[len-2] = 0;
|
||||
r_sys_setenv (buf, p);
|
||||
}
|
||||
}
|
||||
fclose (fd);
|
||||
|
Loading…
Reference in New Issue
Block a user