소스 검색

Don't drain extra data when parsing socks auth methods

We added this back in 0649fa14 in 2006, to deal with the case where
the client unconditionally sent us authentication data.  Hopefully,
that's not needed any longer, since we now can actually parse
authentication data.
Nick Mathewson 14 년 전
부모
커밋
ee42fe8fbb
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      src/or/buffers.c

+ 3 - 3
src/or/buffers.c

@@ -1736,9 +1736,9 @@ parse_socks(const char *data, size_t datalen, socks_request_t *req,
           req->reply[1] = '\xFF'; /* reject all methods */
           r=-1;
         }
-        /* remove packet from buf. also remove any other extraneous
-         * bytes, to support broken socks clients. */
-        *drain_out = -1;
+        /* Remove packet from buf. Some SOCKS clients will have sent extra
+         * junk at this point; let's hope it's an authentication message. */
+        *drain_out = 2u + nummethods;
 
         return r;
       }