[gnome-desktop] gnome-pnp-ids: Re-add validation tweaks



commit b7d00c429868c4c6e4b604ee4cf70fab369be869
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Sep 20 11:10:02 2011 +0100

    gnome-pnp-ids: Re-add validation tweaks
    
    Which were lost in the port to the new object.

 libgnome-desktop/gnome-pnp-ids.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/libgnome-desktop/gnome-pnp-ids.c b/libgnome-desktop/gnome-pnp-ids.c
index 909aa52..1ff6ac9 100644
--- a/libgnome-desktop/gnome-pnp-ids.c
+++ b/libgnome-desktop/gnome-pnp-ids.c
@@ -221,11 +221,13 @@ gnome_pnp_ids_load (GnomePnpIds *pnp_ids, GError **error)
                 priv->table_data[i] = '\0';
 
                 /* the ID to text is a fixed offset */
-                retval[3] = '\0';
-                g_hash_table_insert (priv->pnp_table,
-                                     retval,
-                                     retval+4);
-                retval = &priv->table_data[i+1];
+                if (retval[0] && retval[1] && retval[2] && retval[3] == '\t' && retval[4]) {
+                        retval[3] = '\0';
+                        g_hash_table_insert (priv->pnp_table,
+                                             retval,
+                                             retval+4);
+                        retval = &priv->table_data[i+1];
+                }
         }
 out:
         g_free (filename);



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