[Asterisk-code-review] AMI: Escape string values. (asterisk[13])
Kevin Harwell
asteriskteam at digium.com
Wed Jun 3 10:29:01 CDT 2015
Kevin Harwell has posted comments on this change.
Change subject: AMI: Escape string values.
......................................................................
Patch Set 2:
(1 comment)
https://gerrit.asterisk.org/#/c/560/2/main/utils.c
File main/utils.c:
Line 1652: for (p = dest; *s && num--; ++s, ++p) {
: /* If in the list of characters to escape then escape it */
: if (strchr(to_escape, *s)) {
> I gave this a bit more thought, and unfortunately strchr as it exists is go
For this algorithm '\0' is not a valid character to escape. It only exists at the end of the ast_escape_sequences array to null terminate the string (I thought about initializing it as follows: const char *ast_escape_sequences = "\a\b\f\n...\?", but I felt initializing it as a character array made it easier to differentiate the sequences when reading the code).
I can add a comment stating the the null terminator is not included as a valid escape character.
--
To view, visit https://gerrit.asterisk.org/560
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib55a5b84fe0481b0f2caaaab68c566f392c0aac0
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-HasComments: Yes
More information about the asterisk-code-review
mailing list