diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/tagcache.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c index f800c5646b..5ba955f6ce 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c | |||
@@ -3157,17 +3157,13 @@ static bool write_tag(int fd, const char *tagstr, const char *datastr) | |||
3157 | int i; | 3157 | int i; |
3158 | 3158 | ||
3159 | snprintf(buf, sizeof buf, "%s=\"", tagstr); | 3159 | snprintf(buf, sizeof buf, "%s=\"", tagstr); |
3160 | for (i = strlen(buf); i < (long)sizeof(buf)-3; i++) | 3160 | for (i = strlen(buf); i < (long)sizeof(buf)-4; i++) |
3161 | { | 3161 | { |
3162 | if (*datastr == '\0') | 3162 | if (*datastr == '\0') |
3163 | break; | 3163 | break; |
3164 | 3164 | ||
3165 | if (*datastr == '"') | 3165 | if (*datastr == '"' || *datastr == '\\') |
3166 | { | 3166 | buf[i++] = '\\'; |
3167 | buf[i] = '\\'; | ||
3168 | datastr++; | ||
3169 | continue; | ||
3170 | } | ||
3171 | 3167 | ||
3172 | buf[i] = *(datastr++); | 3168 | buf[i] = *(datastr++); |
3173 | } | 3169 | } |
@@ -3222,9 +3218,9 @@ static bool read_tag(char *dest, long size, | |||
3222 | if (*src == '\0') | 3218 | if (*src == '\0') |
3223 | break; | 3219 | break; |
3224 | 3220 | ||
3225 | if (*src == '\\' && *(src+1) == '"') | 3221 | if (*src == '\\') |
3226 | { | 3222 | { |
3227 | dest[pos] = '"'; | 3223 | dest[pos] = *(src+1); |
3228 | src += 2; | 3224 | src += 2; |
3229 | continue; | 3225 | continue; |
3230 | } | 3226 | } |