]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logind: zero-initialize dispatch struct in vl_method_release_session()
authorYaping Li <202858510+YapingLi04@users.noreply.github.com>
Sun, 10 May 2026 14:50:13 +0000 (14:50 +0000)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 12 May 2026 22:47:18 +0000 (07:47 +0900)
The local struct passed to sd_varlink_dispatch() was not
zero-initialized. Since sd_json_dispatch_full() does not call handlers
for absent optional fields, p.id could be left indeterminate when
the client omits the Id parameter, leading to use of uninitialized
memory.

src/login/logind-varlink.c

index 56b02b4eb2eee86b1f4859bee9de7b0998bc8b4b..71a445e90032efb14fe0db32f00dfe5440fb7041 100644 (file)
@@ -310,7 +310,7 @@ static int vl_method_release_session(sd_varlink *link, sd_json_variant *paramete
 
         struct {
                 const char *id;
-        } p;
+        } p = {};
 
         static const sd_json_dispatch_field dispatch_table[] = {
                 { "Id", SD_JSON_VARIANT_STRING, sd_json_dispatch_const_string, voffsetof(p, id), 0 },