1
0
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:
Jakub Jelen
2025-02-06 13:38:02 +01:00
parent 79ac8b85d8
commit d1ce336ae3

View File

@@ -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;