git: d24b27283290 - main - heimdal: Add additional checks for bad kadmind input

From: Cy Schubert <cy_at_FreeBSD.org>
Date: Thu, 01 Dec 2022 14:24:33 UTC
The branch main has been updated by cy:

URL: https://cgit.FreeBSD.org/src/commit/?id=d24b27283290e404dfa2bf38cd0769e92092e384

commit d24b27283290e404dfa2bf38cd0769e92092e384
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-11-30 23:53:49 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-12-01 14:24:12 +0000

    heimdal: Add additional checks for bad kadmind input
    
    Check return codes for bad input.
    
    MFC after:      3 days
---
 crypto/heimdal/kadmin/server.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/crypto/heimdal/kadmin/server.c b/crypto/heimdal/kadmin/server.c
index ed6ba5a1f790..19dfd89d521a 100644
--- a/crypto/heimdal/kadmin/server.c
+++ b/crypto/heimdal/kadmin/server.c
@@ -428,9 +428,11 @@ kadmind_dispatch(void *kadm_handlep, krb5_boolean initial,
 	krb5_store_int32(sp, ret);
 	if(ret == 0){
 	    int i;
-	    krb5_store_int32(sp, n_princs);
+	    if ((ret = krb5_store_int32(sp, n_princs)))
+		goto fail;
 	    for(i = 0; i < n_princs; i++)
-		krb5_store_string(sp, princs[i]);
+		if ((ret = krb5_store_string(sp, princs[i])))
+			goto fail;
 	    kadm5_free_name_list(kadm_handlep, princs, &n_princs);
 	}
 	break;
@@ -451,7 +453,7 @@ fail:
     krb5_store_int32(sp, ret);
     krb5_storage_to_data(sp, out);
     krb5_storage_free(sp);
-    return 0;
+    return ret;
 }
 
 static void