[ekiga] Fixed crash when device list is empty or contains non-latin1 characters



commit b3473dea7bd23fb44ce8b9195f6192dbe65301f7
Author: Eugen Dedu <Eugen Dedu pu-pm univ-fcomte fr>
Date:   Fri Jul 24 19:27:29 2009 +0200

    Fixed crash when device list is empty or contains non-latin1 characters
    
    Bugs #589403 and https://bugs.launchpad.net/ubuntu/+source/ekiga/+bug/402985.

 lib/engine/components/ptlib/utils.cpp |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/lib/engine/components/ptlib/utils.cpp b/lib/engine/components/ptlib/utils.cpp
index 197b649..72626b6 100644
--- a/lib/engine/components/ptlib/utils.cpp
+++ b/lib/engine/components/ptlib/utils.cpp
@@ -43,6 +43,9 @@ latin2utf (const std::string str)
 {
   gchar *utf8_str;
   std::string result;
+
+  if (str == NULL)
+    return NULL;
 #ifdef WIN32
   utf8_str = g_locale_to_utf8 (str.c_str (), -1,
                                NULL, NULL, NULL);
@@ -51,6 +54,8 @@ latin2utf (const std::string str)
                         "UTF-8", "ISO-8859-1",
                         NULL, NULL, NULL);
 #endif
+  if (utf8_str == NULL) /* conversion error */
+    return NULL;
   result = std::string (utf8_str);
   g_free (utf8_str);
   return result;
@@ -63,6 +68,8 @@ utf2latin (const std::string str)
   gchar *latin_str;
   std::string result;
 
+  if (str == NULL)
+    return NULL;
   g_warn_if_fail (g_utf8_validate (str.c_str (), -1, NULL));
 #ifdef WIN32
   latin_str = g_locale_from_utf8 (str.c_str (), -1,
@@ -72,6 +79,8 @@ utf2latin (const std::string str)
                          "ISO-8859-1", "UTF-8",
                          NULL, NULL, NULL);
 #endif
+  if (latin_str == NULL) /* conversion error */
+    return NULL;
   result = std::string (latin_str);
   g_free (latin_str);
   return result;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]