fixed actual ID length when AT_IDENTITY gets padded
authorMartin Willi <martin@strongswan.org>
Thu, 13 Dec 2007 14:39:38 +0000 (14:39 -0000)
committerMartin Willi <martin@strongswan.org>
Thu, 13 Dec 2007 14:39:38 +0000 (14:39 -0000)
src/charon/sa/authenticators/eap/eap_sim.c

index 38d7f25..e369c56 100644 (file)
@@ -264,6 +264,7 @@ static eap_payload_t *build_payload(private_eap_sim_t *this, u_int8_t identifier
                        }
                        case AT_IDENTITY:
                        {
+                               u_int16_t act_len = data.len;
                                /* align up to four byte */
                                if (data.len % 4)
                                {
@@ -275,7 +276,7 @@ static eap_payload_t *build_payload(private_eap_sim_t *this, u_int8_t identifier
                                *pos.ptr = data.len/4 + 1;
                                pos = chunk_skip(pos, 1);
                                /* actual length in bytes */
-                               *(u_int16_t*)pos.ptr = htons(data.len);
+                               *(u_int16_t*)pos.ptr = htons(act_len);
                                pos = chunk_skip(pos, sizeof(u_int16_t));
                                memcpy(pos.ptr, data.ptr, data.len);
                                pos = chunk_skip(pos, data.len);