From 92b5a08e81c4a7c976c160ed6ebc2b426500e2f9 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Sun, 23 Mar 1997 05:02:32 +0000 Subject: [PATCH] Proper check for success of `base64_decode' git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1477 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/ftp/ftp/kauth.c | 6 ++++-- appl/ftp/ftpd/krb4.c | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/appl/ftp/ftp/kauth.c b/appl/ftp/ftp/kauth.c index 7f5b53a1d..829a7cbed 100644 --- a/appl/ftp/ftp/kauth.c +++ b/appl/ftp/ftp/kauth.c @@ -52,6 +52,7 @@ void kauth(int argc, char **argv) char *p; int overbose; char passwd[100]; + int tmp; if(argc > 2){ printf("usage: %s [principal]\n", argv[0]); @@ -80,12 +81,13 @@ void kauth(int argc, char **argv) return; } p += 2; - tkt.length = base64_decode(p, &tkt.dat); - if(tkt.length < 0){ + tmp = base64_decode(p, &tkt.dat); + if(tmp < 0){ printf("Failed to decode base64 in reply.\n"); code = -1; return; } + tkt.length = tmp; tktcopy.length = tkt.length; p = strstr(reply_string, "P="); diff --git a/appl/ftp/ftpd/krb4.c b/appl/ftp/ftpd/krb4.c index 2b58d941f..70dcd6482 100644 --- a/appl/ftp/ftpd/krb4.c +++ b/appl/ftp/ftpd/krb4.c @@ -86,12 +86,13 @@ int krb4_adat(char *auth) char inst[INST_SZ]; memset(&tkt, 0, sizeof(tkt)); - tkt.length = base64_decode(auth, tkt.dat); + len = base64_decode(auth, tkt.dat); - if(tkt.length < 0){ + if(len < 0){ reply(501, "Failed to decode base64 data."); return -1; } + tkt.length = len; k_getsockinst(0, inst); kerror = krb_rd_req(&tkt, "ftp", inst, 0, &auth_dat, "");