mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-10-27 13:52:20 +03:00
config: Allow escaping quotes inside of quoted tokens
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@@ -82,6 +82,13 @@ char *ssh_config_get_token(char **str)
|
||||
if (*c == '\"') {
|
||||
for (r = ++c; *c; c++) {
|
||||
if (*c == '\"' || *c == '\n') {
|
||||
if (*c == '\"' && r != c && *(c - 1) == '\\') {
|
||||
/* Escaped quote: Move the remaining one char left */
|
||||
int remaining_len = strlen(c);
|
||||
memmove(c - 1, c, remaining_len);
|
||||
c[remaining_len - 1] = '\0';
|
||||
continue;
|
||||
}
|
||||
*c = '\0';
|
||||
c++;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user