]> git.ozlabs.org Git - ppp.git/commitdiff
skip response length byte before handling the response itself,
authorFrank Cusack <fcusack@fcusack.com>
Thu, 10 Jul 2003 17:59:33 +0000 (17:59 +0000)
committerFrank Cusack <fcusack@fcusack.com>
Thu, 10 Jul 2003 17:59:33 +0000 (17:59 +0000)
thx to Paul Flinders

pppd/chap_ms.c

index a489cc0d111aae8d61af1aed4432b06ddd5ce574..2dde5ba76b60a3dbb297ffce23480175edecc1ac 100644 (file)
@@ -74,7 +74,7 @@
  *
  */
 
-#define RCSID  "$Id: chap_ms.c,v 1.29 2003/06/11 23:56:26 paulus Exp $"
+#define RCSID  "$Id: chap_ms.c,v 1.30 2003/07/10 17:59:33 fcusack Exp $"
 
 #ifdef CHAPMS
 
@@ -186,17 +186,18 @@ chapms_verify_response(int id, char *name,
                       unsigned char *challenge, unsigned char *response,
                       char *message, int message_space)
 {
-       MS_ChapResponse *rmd = (MS_ChapResponse *) response;
+       MS_ChapResponse *rmd;
        MS_ChapResponse md;
        int diff;
        int challenge_len, response_len;
 
        challenge_len = *challenge++;   /* skip length, is 8 */
-
        response_len = *response++;
        if (response_len != MS_CHAP_RESPONSE_LEN)
                goto bad;
 
+       rmd = (MS_ChapResponse *) response;
+
 #ifndef MSLANMAN
        if (!rmd->UseNT[0]) {
                /* Should really propagate this into the error packet. */
@@ -235,7 +236,7 @@ chapms2_verify_response(int id, char *name,
                        unsigned char *challenge, unsigned char *response,
                        char *message, int message_space)
 {
-       MS_Chap2Response *rmd = (MS_Chap2Response *) response;
+       MS_Chap2Response *rmd;
        MS_Chap2Response md;
        char saresponse[MS_AUTH_RESPONSE_LENGTH+1];
        int challenge_len, response_len;
@@ -245,6 +246,8 @@ chapms2_verify_response(int id, char *name,
        if (response_len != MS_CHAP2_RESPONSE_LEN)
                goto bad;       /* not even the right length */
 
+       rmd = (MS_Chap2Response *) response;
+
        /* Generate the expected response and our mutual auth. */
        ChapMS2(challenge, rmd->PeerChallenge, name,
                secret, secret_len, &md,