Use load_store_16/32_be
authorKen Raeburn <raeburn@mit.edu>
Sat, 2 Aug 2008 06:44:08 +0000 (06:44 +0000)
committerKen Raeburn <raeburn@mit.edu>
Sat, 2 Aug 2008 06:44:08 +0000 (06:44 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20601 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/gssapi/krb5/export_name.c
src/lib/gssapi/mechglue/g_imp_name.c

index 2d27ba46c8996e7523dcefba0c6bf6c0c95e8ceb..9a54032b1d736bfbabb2135ae9ddad35bfc51016 100644 (file)
@@ -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);
index c7864454285822caf574bb2380ad2dbc8ea494d8..bb7db31954f1e7c77b412c24382b6d5abb416ef2 100644 (file)
@@ -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