aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_agi.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-01-08 22:37:20 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-01-08 22:37:20 +0000
commitcd081b854580da4ca5590890976c371e6269ea56 (patch)
tree6cf354d303488fc1477d6bb47133c6d394697562 /res/res_agi.c
parent03d0711cc0ec67bebbf4627338152bc99a2b4ba0 (diff)
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/trunk@167894 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_agi.c')
-rw-r--r--res/res_agi.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/res/res_agi.c b/res/res_agi.c
index 21b554812..926d4d95b 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -1849,16 +1849,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], ast_str_buffer(buf), ast_str_size(buf));
+ if (ast_str_strlen(buf) < ast_str_size(buf) - 1) {
+ break;
+ }
+ if (ast_str_make_space(&buf, ast_str_size(buf) * 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", ast_str_buffer(buf));
+ ast_free(buf);
return RESULT_SUCCESS;
}