libuser/0010-resource-leak.patch
Michal Hlavinka 177685d091 fix findings from static application security testing (#RHEL-35578)
translation update (#RHEL-12111)
Resolves: #RHEL-35578
2024-07-23 21:05:37 +02:00

40 lines
1.3 KiB
Diff

diff -up libuser-0.62/lib/user.c.orig libuser-0.62/lib/user.c
--- libuser-0.62/lib/user.c.orig 2024-05-07 17:03:45.220514343 +0200
+++ libuser-0.62/lib/user.c 2024-05-07 17:05:17.855649386 +0200
@@ -986,7 +986,10 @@ lu_dispatch(struct lu_context *context,
case user_default:
case group_default:
/* Make sure we have both name and boolean here. */
- g_return_val_if_fail(sdata != NULL, FALSE);
+ if (sdata == NULL) {
+ free(tmp);
+ return FALSE;
+ }
/* Run the checks and preps. */
if (run_list(context, context->create_module_names,
logic_and, id,
@@ -1065,7 +1068,10 @@ lu_dispatch(struct lu_context *context,
case user_setpass:
case group_setpass:
/* Make sure we have a valid password. */
- g_return_val_if_fail(sdata != NULL, FALSE);
+ if (sdata == NULL) {
+ free(tmp);
+ return FALSE;
+ }
/* no break: fall through */
case user_removepass:
case group_removepass:
@@ -1094,7 +1100,10 @@ lu_dispatch(struct lu_context *context,
case users_enumerate_by_group:
case groups_enumerate_by_user:
/* Make sure we have both name and ID here. */
- g_return_val_if_fail(sdata != NULL, FALSE);
+ if (sdata == NULL) {
+ free(tmp);
+ return FALSE;
+ }
if (id == users_enumerate_by_group)
ldata = convert_group_name_to_id(context, sdata,
error);