]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Force an error if a blank is passed to QUOTE (because the documentation states the...
authorTilghman Lesher <tilghman@meg.abyt.es>
Tue, 21 Jul 2009 22:38:54 +0000 (22:38 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Tue, 21 Jul 2009 22:38:54 +0000 (22:38 +0000)
This change makes URIENCODE and QUOTE behave similarly, since the documentation
states that the argument is not optional, for both.
(closes issue #15439)
 Reported by: pkempgen
 Patches:
       20090706__issue15439.diff.txt uploaded by tilghman (license 14)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@207945 65c4cc65-6c06-0410-ace0-fbb531ad65f3

funcs/func_strings.c

index 8b0d562ba948015e0645e09cfd61ba0b37f75e65..b0e7dfb5084ddbd6d8a7a8b639fc8a5fcf54209f 100644 (file)
@@ -384,6 +384,12 @@ static struct ast_custom_function sprintf_function = {
 static int quote(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
 {
        char *bufptr = buf, *dataptr = data;
+       if (ast_strlen_zero(data)) {
+               ast_log(LOG_WARNING, "No argument specified!\n");
+               ast_copy_string(buf, "\"\"", len);
+               return 0;
+       }
+
        *bufptr++ = '"';
        for (; bufptr < buf + len - 1; dataptr++) {
                if (*dataptr == '\\') {