From 076b4406c10b159e7ba52b38ae0e34148ad61588 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Sat, 2 Aug 2008 06:44:08 +0000 Subject: [PATCH] Use load_store_16/32_be git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20601 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/gssapi/krb5/export_name.c | 10 ++++------ src/lib/gssapi/mechglue/g_imp_name.c | 6 ++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/lib/gssapi/krb5/export_name.c b/src/lib/gssapi/krb5/export_name.c index 2d27ba46c..9a54032b1 100644 --- a/src/lib/gssapi/krb5/export_name.c +++ b/src/lib/gssapi/krb5/export_name.c @@ -79,16 +79,14 @@ OM_uint32 krb5_gss_export_name(OM_uint32 *minor_status, /* Note: we assume the OID will be less than 128 bytes... */ *cp++ = 0x04; *cp++ = 0x01; - *cp++ = (gss_mech_krb5->length+2) >> 8; - *cp++ = (gss_mech_krb5->length+2) & 0xFF; + store_16_be(gss_mech_krb5->length+2, cp); + cp += 2; *cp++ = 0x06; *cp++ = (gss_mech_krb5->length) & 0xFF; memcpy(cp, gss_mech_krb5->elements, gss_mech_krb5->length); cp += gss_mech_krb5->length; - *cp++ = length >> 24; - *cp++ = length >> 16; - *cp++ = length >> 8; - *cp++ = length & 0xFF; + store_32_be(length, cp); + cp += 4; memcpy(cp, str, length); free(str); diff --git a/src/lib/gssapi/mechglue/g_imp_name.c b/src/lib/gssapi/mechglue/g_imp_name.c index c78644542..bb7db3195 100644 --- a/src/lib/gssapi/mechglue/g_imp_name.c +++ b/src/lib/gssapi/mechglue/g_imp_name.c @@ -286,10 +286,8 @@ importExportName(minor, unionName) return (GSS_S_DEFECTIVE_TOKEN); /* next 4 bytes in the name are the name length */ - nameLen = (*buf++) << 24; - nameLen |= (*buf++ << 16); - nameLen |= (*buf++ << 8); - nameLen |= (*buf++); + nameLen = load_32_be(buf); + buf += 4; /* * we use < here because bad code in rpcsec_gss rounds up exported -- 2.26.2