8040332: fixpath must explicitly quote empty string parameters
Reviewed-by: ihse
This commit is contained in:
parent
4acce14c79
commit
813a1a66d2
@ -118,7 +118,7 @@ void append(char **b, size_t *bl, size_t *u, char *add, size_t addlen)
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates a new string from in where the first occurance of sub is
|
||||
* Creates a new string from in where the first occurrence of sub is
|
||||
* replaced by rep.
|
||||
*/
|
||||
char *replace_substring(char *in, char *sub, char *rep)
|
||||
@ -280,6 +280,11 @@ char * quote_arg(char const * in_arg) {
|
||||
char *current = quoted;
|
||||
int pass;
|
||||
|
||||
if (strlen(in_arg) == 0) {
|
||||
// empty string? explicitly quote it.
|
||||
return _strdup("\"\"");
|
||||
}
|
||||
|
||||
if (strpbrk(in_arg, " \t\n\v\r\\\"") == NULL) {
|
||||
return _strdup(in_arg);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user