[liboobs] Fix crash when committing users and groups with no password



commit f79644f2f69b80f013eccfe23548bb828644c8e3
Author: Milan Bouchet-Valat <nalimilan club fr>
Date:   Tue Feb 9 12:27:00 2010 +0100

    Fix crash when committing users and groups with no password
    
    Don't call strlen() on a NULL string!

 oobs/oobs-group.c |    3 ++-
 oobs/oobs-user.c  |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/oobs/oobs-group.c b/oobs/oobs-group.c
index 193d2d9..f10ceff 100644
--- a/oobs/oobs-group.c
+++ b/oobs/oobs-group.c
@@ -360,7 +360,8 @@ oobs_group_commit (OobsObject *object)
 
   /* Erase password field as soon as possible */
   priv = OOBS_GROUP_GET_PRIVATE (OOBS_GROUP (object));
-  memset (priv->password, 0, strlen (priv->password));
+  if (priv->password)
+    memset (priv->password, 0, strlen (priv->password));
 }
 
 /*
diff --git a/oobs/oobs-user.c b/oobs/oobs-user.c
index b6baf5a..a0e2b34 100644
--- a/oobs/oobs-user.c
+++ b/oobs/oobs-user.c
@@ -630,7 +630,8 @@ oobs_user_commit (OobsObject *object)
 
   /* Erase password field as soon as possible */
   priv = OOBS_USER_GET_PRIVATE (OOBS_USER (object));
-  memset (priv->password, 0, strlen (priv->password));
+  if (priv->password)
+    memset (priv->password, 0, strlen (priv->password));
 }
 
 /*



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