mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-01 11:32:25 +00:00
Merged revisions 177664 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r177664 | tilghman | 2009-02-20 11:29:51 -0600 (Fri, 20 Feb 2009) | 8 lines Allow semicolons to be escaped, when passing arguments to the System command. (closes issue #14231) Reported by: jcovert Patches: 20090113__bug14231__2.diff.txt uploaded by Corydon76 (license 14) corrected_20090113__bug14231__2.diff.txt uploaded by jcovert (license 551) Tested by: jcovert ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@177761 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
27
main/app.c
27
main/app.c
@@ -1836,6 +1836,33 @@ int ast_get_encoded_str(const char *stream, char *result, size_t result_size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ast_str_get_encoded_str(struct ast_str **str, int maxlen, const char *stream)
|
||||
{
|
||||
char next, *buf;
|
||||
size_t offset = 0;
|
||||
size_t consumed;
|
||||
|
||||
if (strchr(stream, '\\')) {
|
||||
while (!ast_get_encoded_char(stream, &next, &consumed)) {
|
||||
if (offset + 2 > ast_str_size(*str) && maxlen > -1) {
|
||||
ast_str_make_space(str, maxlen > 0 ? maxlen : (ast_str_size(*str) + 48) * 2 - 48);
|
||||
}
|
||||
if (offset + 2 > ast_str_size(*str)) {
|
||||
break;
|
||||
}
|
||||
buf = ast_str_buffer(*str);
|
||||
buf[offset++] = next;
|
||||
stream += consumed;
|
||||
}
|
||||
buf = ast_str_buffer(*str);
|
||||
buf[offset++] = '\0';
|
||||
ast_str_update(*str);
|
||||
} else {
|
||||
ast_str_set(str, maxlen, "%s", stream);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ast_close_fds_above_n(int n)
|
||||
{
|
||||
int x, null;
|
||||
|
||||
Reference in New Issue
Block a user