From 702a9cad2dbeb3c6d633a46a16e1f360b42ea78c Mon Sep 17 00:00:00 2001 From: chenwei Date: Mon, 16 Apr 2018 18:52:58 +0800 Subject: [PATCH] Nginx: fixbug, hijack `__recv_chk`. Nginx maybe call `__recv_chk` with https because of _FORTIFY_SOURCE. Refer to #179. See _FORTIFY_SOURCE (since glibc 2.3.4) --- app/nginx-1.11.10/src/event/modules/ngx_ff_module.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/nginx-1.11.10/src/event/modules/ngx_ff_module.c b/app/nginx-1.11.10/src/event/modules/ngx_ff_module.c index 48045097..bbcce876 100644 --- a/app/nginx-1.11.10/src/event/modules/ngx_ff_module.c +++ b/app/nginx-1.11.10/src/event/modules/ngx_ff_module.c @@ -325,6 +325,16 @@ recv(int sockfd, void *buf, size_t len, int flags) return SYSCALL(recv)(sockfd, buf, len, flags); } +ssize_t +__recv_chk (int fd, void *buf, size_t n, size_t buflen, int flags) +{ +/* + if (n > buflen) + __chk_fail (); +*/ + return recv (fd, buf, n, flags); +} + int listen(int sockfd, int backlog) {