Skip to content

more secure compile time options and removed unused variables #10

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
TARGET=libindp.so
CC=gcc
CFLAGS=-nostartfiles -fpic -shared -D_GNU_SOURCE -fstack-protector-all -Wall -Wextra -Wformat-security -O2 -D_FORTIFY_SOURCE=2 -fstack-clash-protection -fcf-protection
LDFLAGS=-ldl -Wl,-z,relro -Wl,-z,now -Wl,-z,defs -Wl,-z,noexecstack

all:
gcc -nostartfiles -fpic -shared bindp.c -o ${TARGET} -ldl -D_GNU_SOURCE
$(CC) $(CFLAGS) bindp.c -o $(TARGET) $(LDFLAGS)

clean:
rm ${TARGET} -f
rm -f $(TARGET)
12 changes: 5 additions & 7 deletions bindp.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ int bind (int fd, const struct sockaddr *sk, socklen_t sl) {
#endif

if (ip_transparent) {
int opt =1;
setsockopt(fd, SOL_IP, IP_TRANSPARENT, &ip_transparent, sizeof(ip_transparent));
}

Expand All @@ -214,13 +213,9 @@ int connect (int fd, const struct sockaddr *sk, socklen_t sl) {
if (debug_enabled) {
printf("[-] connect(): AF_INET connect() call, binding to local address\n");
}
static struct sockaddr_in *rsk_in;

rsk_in = (struct sockaddr_in *)sk;

if (bind_addr_saddr || bind_port_saddr) {
int r = bind (fd, (struct sockaddr *)local_sockaddr_in, sizeof (struct sockaddr));

bind (fd, (struct sockaddr *)local_sockaddr_in, sizeof (struct sockaddr));
}
return real_connect (fd, sk, sl);

Expand All @@ -232,6 +227,9 @@ int connect (int fd, const struct sockaddr *sk, socklen_t sl) {
}
}

int main(int argc,char **argv) {

int main(int argc, char **argv) {
(void)argc; // Suppress unused parameter warning
(void)argv; // Suppress unused parameter warning
return 0;
}