[hackers] [quark] Check inet_pton() for system error || Laslo Hunhold

From: <git_AT_suckless.org>
Date: Sun, 9 Jul 2017 00:11:47 +0200 (CEST)

commit af61e37a3a282fb78a9f5ae308bb3f56d11d7406
Author: Laslo Hunhold <dev_AT_frign.de>
AuthorDate: Sun Jul 9 00:11:30 2017 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Sun Jul 9 00:11:30 2017 +0200

    Check inet_pton() for system error

diff --git a/quark.c b/quark.c
index af6e536..2a836b0 100644
--- a/quark.c
+++ b/quark.c
_AT_@ -590,8 +590,10 @@ sendresponse(int fd, struct request *r)
                 /* RFC 2732 specifies to use brackets for IPv6-addresses in
                  * URLs, so we need to check if our host is one and honor that
                  * later when we fill the "Location"-field */
- ipv6host = inet_pton(AF_INET6, r->field[REQ_HOST][0] ?
- r->field[REQ_HOST] : host, &res);
+ if ((ipv6host = inet_pton(AF_INET6, r->field[REQ_HOST][0] ?
+ r->field[REQ_HOST] : host, &res)) < 0) {
+ return sendstatus(fd, S_INTERNAL_SERVER_ERROR);
+ }
 
                 /* encode realtarget */
                 encode(realtarget, tmptarget);
Received on Sun Jul 09 2017 - 00:11:47 CEST

This archive was generated by hypermail 2.3.0 : Sun Jul 09 2017 - 00:12:46 CEST