[telepathy-sofiasip/master] Addressed Will's comments on codec parameter parsers and quoting utilities

Mikhail Zabaluev mikhail.zabaluev at nokia.com
Mon Nov 23 05:13:09 PST 2009


---
 tpsip/codec-param-formats.c |    3 +--
 tpsip/util.c                |    9 ++++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/tpsip/codec-param-formats.c b/tpsip/codec-param-formats.c
index 6c19632..3cffc48 100644
--- a/tpsip/codec-param-formats.c
+++ b/tpsip/codec-param-formats.c
@@ -322,8 +322,7 @@ tpsip_codec_param_formats_init ()
       "(?<"  FMTP_MATCH_NAME_VALUE ">" FMTP_TOKEN_VALUE ")"
       "\\s*(;\\s*|$)",
       G_REGEX_RAW | G_REGEX_OPTIMIZE,
-      0 /* G_REGEX_MATCH_ANCHORED */,
-      NULL);
+      0, NULL);
   g_assert (fmtp_attr_regex != NULL);
 
 #define DTMF_RANGE "[0-9]+(-[0-9]+)?"
diff --git a/tpsip/util.c b/tpsip/util.c
index 66f66be..bf74dbf 100644
--- a/tpsip/util.c
+++ b/tpsip/util.c
@@ -136,7 +136,14 @@ tpsip_unquote_string (const gchar *src, gsize len)
   for (i = 1; i < len - 1; ++i)
     {
       if (src[i] == '\\')
-        ++i;
+        {
+          ++i;
+          if (G_UNLIKELY (i == len - 1))
+            {
+              g_critical ("the quoted string is missing the termination quote, improperly escaped?");
+              return NULL;
+            }
+        }
       *p++ = src[i];
     }
  
-- 
1.5.6.5




More information about the telepathy-commits mailing list