Skip to content

Instantly share code, notes, and snippets.

@cxreg
Created April 4, 2013 00:35
Show Gist options
  • Save cxreg/5306732 to your computer and use it in GitHub Desktop.
Save cxreg/5306732 to your computer and use it in GitHub Desktop.
Use a simple format string for JSON printing, thus not interpreting % as a conversion specifier
--- a/src/mod/applications/mod_commands/mod_commands.c
+++ b/src/mod/applications/mod_commands/mod_commands.c
@@ -4809,7 +4809,7 @@ SWITCH_STANDARD_API(show_function)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
holder.stream->write_function(holder.stream, "-ERR Memory Error!\n");
} else {
- holder.stream->write_function(holder.stream, json_text);
+ holder.stream->write_function(holder.stream, "%s", json_text);
}
cJSON_Delete(result);
switch_safe_free(json_text);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment