]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add switch_clean_name_string to strip out caller id name chars that can cause issues
authorMichael Jerris <mike@jerris.com>
Thu, 14 Apr 2011 21:51:45 +0000 (17:51 -0400)
committerMichael Jerris <mike@jerris.com>
Thu, 14 Apr 2011 21:51:45 +0000 (17:51 -0400)
src/include/switch_utils.h

index b08c20488926d4a3f636cde724c44e8b457a342a..4135ade0919d2ebe80cefbc51c78110e13b0a711 100644 (file)
@@ -500,6 +500,23 @@ static inline char *switch_clean_string(char *s)
 }
 
 
+static inline char *switch_clean_name_string(char *s)
+{
+       char *p;
+       for (p = s; p && *p; p++) {
+               uint8_t x = (uint8_t) * p;
+               if ((x < 32) || x == '\'' || x == '"' || x == '<' || x == '>' || x == '\\' || x == ':' || x == '@' || x == '/') {
+                       *p = ' ';
+               }
+               if ( (p == s) && (*p == ' ') ) {
+                       s++;
+               }
+       }
+
+       return s;
+}
+
+
 
 /*!
   \brief Free a pointer and set it to NULL unless it already is NULL