diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-01-08 22:45:36 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-01-08 22:45:36 +0000 |
commit | 78bc8a0e0a2d82d72f11dcd90ff8086d969b488a (patch) | |
tree | a689956e7ef5bcc2e6800b43ed47e90cfabcc7f9 /res | |
parent | 4ef90bb5568af7fe9bcc65f10f28950ad4c1dcab (diff) |
Merged revisions 167894 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r167894 | tilghman | 2009-01-08 16:37:20 -0600 (Thu, 08 Jan 2009) | 13 lines
Merged revisions 167840 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r167840 | tilghman | 2009-01-08 16:08:56 -0600 (Thu, 08 Jan 2009) | 6 lines
Don't truncate database results at 255 chars.
(closes issue #14069)
Reported by: evandro
Patches:
20081214__bug14069.diff.txt uploaded by Corydon76 (license 14)
........
................
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@167905 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r-- | res/res_agi.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/res/res_agi.c b/res/res_agi.c index 58ee1f4fa..5fcfdb878 100644 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -1607,16 +1607,32 @@ static int handle_verbose(struct ast_channel *chan, AGI *agi, int argc, char **a static int handle_dbget(struct ast_channel *chan, AGI *agi, int argc, char **argv) { int res; - char tmp[256]; + struct ast_str *buf; if (argc != 4) return RESULT_SHOWUSAGE; - res = ast_db_get(argv[2], argv[3], tmp, sizeof(tmp)); + + if (!(buf = ast_str_create(16))) { + ast_agi_send(agi->fd, chan, "200 result=-1\n"); + return RESULT_SUCCESS; + } + + do { + res = ast_db_get(argv[2], argv[3], buf->str, buf->len); + if (buf->used < buf->len - 1) { + break; + } + if (ast_str_make_space(&buf, buf->len * 2)) { + break; + } + } while (1); + if (res) ast_agi_send(agi->fd, chan, "200 result=0\n"); else - ast_agi_send(agi->fd, chan, "200 result=1 (%s)\n", tmp); + ast_agi_send(agi->fd, chan, "200 result=1 (%s)\n", buf->str); + ast_free(buf); return RESULT_SUCCESS; } |