Warn and don't crash when meeting a trailing \\. (#301373, Benjamin Otte)
[platform/upstream/glib.git] / glib / gstrfuncs.c
index 8078988..3574f97 100644 (file)
@@ -1966,6 +1966,9 @@ g_strcompress (const gchar *source)
          p++;
          switch (*p)
            {
+           case '\0':
+             g_warning ("g_strcompress: trailing \\");
+             goto out;
            case '0':  case '1':  case '2':  case '3':  case '4':
            case '5':  case '6':  case '7':
              *q = 0;
@@ -2002,6 +2005,7 @@ g_strcompress (const gchar *source)
        *q++ = *p;
       p++;
     }
+out:
   *q = 0;
   
   return dest;