]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix error handling in gssint_mechglue_init()
authorGreg Hudson <ghudson@mit.edu>
Sat, 11 Jan 2020 04:47:34 +0000 (23:47 -0500)
committerGreg Hudson <ghudson@mit.edu>
Sat, 25 Jan 2020 04:07:39 +0000 (23:07 -0500)
In the unlikely event that one of the functions called by
gssint_mechglue_init() returns an error, return that error to the
caller rather than continuing on and discarding the error status.
Returning success when some of the operations failed could fool the
library finalizer into thinking that initialization completed.
Reported by Spencer Malone.

(cherry picked from commit c120ed5b211ee684b830a6722fc3ab3222afbfa1)

ticket: 8864
version_fixed: 1.17.2

src/lib/gssapi/mechglue/g_initialize.c

index 0ad11c0b029bca5be2919e1d4f1e5512dc061344..1c24f0a91c8faf2909767418f2f5087c73726fc5 100644 (file)
@@ -114,11 +114,19 @@ gssint_mechglue_init(void)
        add_error_table(&et_ggss_error_table);
 
        err = k5_mutex_finish_init(&g_mechSetLock);
+       if (err)
+               return err;
        err = k5_mutex_finish_init(&g_mechListLock);
+       if (err)
+               return err;
 
 #ifdef _GSS_STATIC_LINK
        err = gss_krb5int_lib_init();
+       if (err)
+               return err;
        err = gss_spnegoint_lib_init();
+       if (err)
+               return err;
 #endif
 
        err = gssint_mecherrmap_init();