r11061 - libprelude/trunk/src
[email protected] Wed, 8 Oct 2008 14:52:37 +0200 (CEST)
Newsgroups
gmane.comp.security.ids.prelude.cvs
Message-ID
<[email protected] >
Author: yoann
Date: 2008-10-08 14:52:35 +0200 (Wed, 08 Oct 2008)
New Revision: 11061
Modified:
libprelude/trunk/src/prelude-client-profile.c
Log:
Fix NULL pointer dereference in case of NULL client profile (fix #320).
Modified: libprelude/trunk/src/prelude-client-profile.c
===================================================================
--- libprelude/trunk/src/prelude-client-profile.c 2008-10-06 15:24:25 UTC (rev 11060)
+++ libprelude/trunk/src/prelude-client-profile.c 2008-10-08 12:52:35 UTC (rev 11061)
@@ -506,17 +506,22 @@
*/
void prelude_client_profile_get_profile_dirname(const prelude_client_profile_t *cp, char *buf, size_t size)
{
- const char *prefix;
+ const char *prefix, *name_sep = "", *name = "";
prelude_return_if_fail(buf);
+ if ( cp && cp->name ) {
+ name_sep = "/";
+ name = cp->name;
+ }
+
gl_lock_lock(lock);
prefix = init_once_and_get_prefix();
if ( ! relative_profile_dir )
- snprintf(buf, size, "%s/%s%s", PRELUDE_PROFILE_DIR, (cp->name) ? "/" : "", (cp->name) ? cp->name : "");
+ snprintf(buf, size, "%s/%s%s", PRELUDE_PROFILE_DIR, name_sep, name);
else
- snprintf(buf, size, "%s/%s%s%s", prefix, relative_profile_dir, (cp->name) ? "/" : "", (cp->name) ? cp->name : "");
+ snprintf(buf, size, "%s/%s%s%s", prefix, relative_profile_dir, name_sep, name);
gl_lock_unlock(lock);
}
_______________________________________________
Prelude-cvslog site list
[email protected]
http://lists.prelude-ids.org/mailman/listinfo/prelude-cvslog