]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix deserializing context with missing profile 1535/head
authorSergey Bugaev <bugaevc@gmail.com>
Mon, 27 Jul 2026 13:17:46 +0000 (16:17 +0300)
committerGreg Hudson <ghudson@mit.edu>
Thu, 6 Aug 2026 16:49:42 +0000 (12:49 -0400)
k5_internalize_context() tolerates EINVAL and ENOENT failures from
profile_ser_internalize(), which should allow it to continue if a
configuration file (such as /etc/krb5.conf) is missing in the
deserializing process.  However, profile_ser_internalize() only
updates the caller's buffer pointer if the profile was initialized, so
k5_internalize_context() attempts to read its trailer from the
serialized profile data and fails.  Change profile_ser_internalize()
to update the caller's buffer pointer once it has consumed a whole
profile serialization, whether or not profile_init() succeeds.

[ghudson@mit.edu: edited commit message and comment]

ticket: 9231 (new)

src/util/profile/prof_init.c

index 783efbde29cf02a79e58ee0b4017e560a7d8ee18..b97d469a1cde3a14409619edbd97624823946f70 100644 (file)
@@ -654,13 +654,13 @@ errcode_t profile_ser_internalize(profile_t *profilep,
         goto cleanup;
     }
 
-    if ((retval = profile_init((const_profile_filespec_t *) flist,
-                               profilep)))
-        goto cleanup;
-
+    /* Update the buffer pointer even if profile initialization fails, so the
+     * caller can keep deserializing from the correct position.  */
     *bufpp = bp;
     *remainp = remain;
 
+    retval = profile_init((const_profile_filespec_t *) flist, profilep);
+
 cleanup:
     if (flist) {
         for (i=0; i<fcount; i++) {