commit f02d57cfae2c18951b665353b21aed02d29731a9
parent cb9b6b70dbc6b33cc29364ba31023ffeb0579085
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 29 Aug 2018 20:22:19 +0200
fix pedantic usage address_len parameter in accept(2)
POSIX says regarding `address_len`:
"on input specifies the length of the supplied sockaddr structure, and on
output specifies the length of the stored address."
So it should be set to the sizeof the used structure.
Signed-off-by: Christoph Lohmann <20h@r-36.net>
Diffstat:
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/main.c b/main.c
@@ -533,8 +533,6 @@ main(int argc, char *argv[])
initsignals();
- cltlen = sizeof(clt);
-
#ifdef __OpenBSD__
char promises[31]; /* check the size needed in the fork too */
snprintf(promises, sizeof(promises), "rpath inet stdio proc exec %s",
@@ -546,6 +544,7 @@ main(int argc, char *argv[])
#endif /* __OpenBSD__ */
while (1) {
+ cltlen = sizeof(clt);
sock = accept(listfd, (struct sockaddr *)&clt, &cltlen);
if (sock < 0) {
switch (errno) {