Skip to content

Commit

Permalink
use n_methods to adhere to the protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
rofl0r committed Mar 1, 2017
1 parent 3f7efb6 commit d5e8203
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sockssrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ static enum authmethod check_auth_method(unsigned char *buf, size_t n, struct cl
if(idx >= n ) return AM_INVALID;
int n_methods = buf[idx];
idx++;
while(idx < n) {
while(idx < n && n_methods > 0) {
if(buf[idx] == AM_NO_AUTH) {
if(!auth_user) return AM_NO_AUTH;
else if(auth_ips) {
Expand All @@ -187,6 +187,7 @@ static enum authmethod check_auth_method(unsigned char *buf, size_t n, struct cl
if(auth_user) return AM_USERNAME;
}
idx++;
n_methods--;
}
return AM_INVALID;
}
Expand Down

0 comments on commit d5e8203

Please sign in to comment.