OPENAFS-SA-2024-002: Avoid uninitialized memory when parsing ACLs 38/15938/2
authorAndrew Deason <adeason@sinenomine.net>
Wed, 6 Nov 2024 05:40:24 +0000 (23:40 -0600)
committerBenjamin Kaduk <kaduk@mit.edu>
Tue, 12 Nov 2024 18:05:53 +0000 (13:05 -0500)
commit21941c0ab2d28fa3a074f46e4d448d518a7c1b8a
tree440d2083892b9681122a5751f8e63894fd87c736
parenta9ede52673b8c8abbfc2577ac6987a8a5686206f
OPENAFS-SA-2024-002: Avoid uninitialized memory when parsing ACLs

CVE-2024-10396

Several places in the tree parse ACLs using sscanf() calls that look
similar to this:

    sscanf(str, "%d dfs:%d %s", &nplus, &dfs, cell);
    sscanf(str, "%100s %d", tname, &trights);

Some callers check whether the scanf() returns negative or 0, but some
callers do not check the return code at all. If only some of the fields
are present in the sscanf()'d string (because, for instance, the ACL is
malformed), some of the arguments are left alone, and may be set to
garbage if the relevant variable was never initialized.

If the parsed ACL is copied to another ACL, this can result in the
copied ACL containing uninitialized memory.

To avoid this, make sure all of the variables passed to sscanf() and
similar calls are initialized before parsing. This commit does not
guarantee that the results make sense, but at least the results do not
contain uninitialized memory.

Reviewed-on: https://gerrit.openafs.org/15917
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit ac602a0a5624b0f0ab04df86f618d09f2a4ad063)

Change-Id: I00245c12993683eb3b58d51cf77742f758bac120
Reviewed-on: https://gerrit.openafs.org/15938
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
src/WINNT/afsd/fs_acl.c
src/kauth/kkids.c
src/kauth/test/test_interim_ktc.c
src/libadmin/client/afs_clientAdmin.c
src/sys/rmtsysnet.c
src/uss/uss_acl.c
src/venus/fs.c