Escape double-quotes, while you're at it.

svn path=/trunk/; revision=8106
This commit is contained in:
Guy Harris 2003-07-30 22:25:35 +00:00
parent bf3727b099
commit 325203fb17
1 changed files with 7 additions and 5 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Id: ftype-string.c,v 1.11 2003/07/30 22:20:04 guy Exp $ * $Id: ftype-string.c,v 1.12 2003/07/30 22:25:35 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
@ -65,8 +65,9 @@ string_repr_len(fvalue_t *fv, ftrepr_t rtype)
case FTREPR_DFILTER: case FTREPR_DFILTER:
repr_len = 0; repr_len = 0;
for (p = fv->value.string; (c = *p) != '\0'; p++) { for (p = fv->value.string; (c = *p) != '\0'; p++) {
if (c == '\\') { if (c == '\\' || c == '"') {
/* Backslashes must be escaped. */ /* Backslashes and double-quotes
must be escaped. */
repr_len++; repr_len++;
} }
repr_len++; repr_len++;
@ -87,8 +88,9 @@ string_to_repr(fvalue_t *fv, ftrepr_t rtype, char *buf)
bufp = buf; bufp = buf;
*bufp++ = '"'; *bufp++ = '"';
for (p = fv->value.string; (c = *p) != '\0'; p++) { for (p = fv->value.string; (c = *p) != '\0'; p++) {
if (c == '\\') { if (c == '\\' || c == '"') {
/* Backslashes must be escaped. */ /* Backslashes and double-quotes
must be escaped. */
*bufp++ = '\\'; *bufp++ = '\\';
} }
*bufp++ = c; *bufp++ = c;