Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ngx_http_auth_digest_module.h #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

davidecrista
Copy link

We discovered a bug with IPv6 authentication: the ngx_memcpy() in the function ngx_http_auth_digest_evasion_tracking() causes a segmentation fault because node.src_addr is defined as struct sockaddr, that is too small to contain a struct sockaddr_in6.
It must be defined as struct sockaddr_storage.

We discovered a bug with IPv6 authentication: the ngx_memcpy() in the function ngx_http_auth_digest_evasion_tracking() causes a segmentation fault because node.src_addr is defined as struct sockaddr, that is too small to contain a struct sockaddr_in6.
It must be defined as struct sockaddr_storage.
Copy link
Collaborator

@erikdubbelboer erikdubbelboer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request!
But I'm afraid only changing the storage type isn't enough. src_addr is passed to ngx_http_auth_digest_srcaddr_cmp as argument which now fails to compile:

../nginx-http-auth-digest/ngx_http_auth_digest_module.c: In function ‘ngx_http_auth_digest_ev_rbtree_cmp’:
../nginx-http-auth-digest/ngx_http_auth_digest_module.c:1047:9: error: passing argument 1 of ‘ngx_http_auth_digest_srcaddr_cmp’ from incompatible pointer type [-Werror]
         evright->src_addrlen);
         ^
In file included from ../nginx-http-auth-digest/ngx_http_auth_digest_module.c:13:0:
../nginx-http-auth-digest/ngx_http_auth_digest_module.h:125:12: note: expected ‘struct sockaddr *’ but argument is of type ‘struct sockaddr_storage *’
 static int ngx_http_auth_digest_srcaddr_cmp(struct sockaddr *sa1,
            ^
../nginx-http-auth-digest/ngx_http_auth_digest_module.c:1047:9: error: passing argument 3 of ‘ngx_http_auth_digest_srcaddr_cmp’ from incompatible pointer type [-Werror]
         evright->src_addrlen);
         ^
In file included from ../nginx-http-auth-digest/ngx_http_auth_digest_module.c:13:0:
../nginx-http-auth-digest/ngx_http_auth_digest_module.h:125:12: note: expected ‘struct sockaddr *’ but argument is of type ‘struct sockaddr_storage *’
 static int ngx_http_auth_digest_srcaddr_cmp(struct sockaddr *sa1,
            ^

Please fix this error.

@Nazar78 Nazar78 mentioned this pull request Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants