From: Tilghman Lesher Date: Fri, 21 Nov 2008 23:33:22 +0000 (+0000) Subject: Allow space within an extension, when the space is within a character class. X-Git-Tag: 1.6.2.0-beta1~797 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=35213dff9805362fee78beae5591641913435f48;p=thirdparty%2Fasterisk.git Allow space within an extension, when the space is within a character class. (requested by lmadsen on -dev, patch by me) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@158605 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/pbx.c b/main/pbx.c index 2621aa1fdd..d765b411ee 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -7228,18 +7228,19 @@ int ast_async_goto_by_name(const char *channame, const char *context, const char static int ext_strncpy(char *dst, const char *src, int len) { int count = 0; + int insquares = 0; while (*src && (count < len - 1)) { - switch (*src) { - case ' ': - /* otherwise exten => [a-b],1,... doesn't work */ - /* case '-': */ - /* Ignore */ - break; - default: - *dst = *src; - dst++; + if (*src == '[') { + insquares = 1; + } else if (*src == ']') { + insquares = 0; + } else if (*src == ' ' && !insquares) { + src++; + continue; } + *dst = *src; + dst++; src++; count++; }