From 348044f12d5f683c8945e0eac642f2795050fb4e Mon Sep 17 00:00:00 2001 From: shennetsind Date: Sat, 17 Jan 2015 17:43:18 -0200 Subject: Another ~10 Fixes Addressing out of bounds read/write, resource leaks. Special Thanks to 4144 and Haruna! Signed-off-by: shennetsind --- src/common/socket.c | 4 ++-- src/common/sql.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/common') diff --git a/src/common/socket.c b/src/common/socket.c index 2ab37109c..9c1f35eee 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -505,7 +505,7 @@ int connect_client(int listen_fd) { int make_listen_bind(uint32 ip, uint16 port) { - struct sockaddr_in server_address; + struct sockaddr_in server_address = { 0 }; int fd; int result; @@ -555,7 +555,7 @@ int make_listen_bind(uint32 ip, uint16 port) } int make_connection(uint32 ip, uint16 port, struct hSockOpt *opt) { - struct sockaddr_in remote_address; + struct sockaddr_in remote_address = { 0 }; int fd; int result; diff --git a/src/common/sql.c b/src/common/sql.c index abc2ed57a..f0b2365a4 100644 --- a/src/common/sql.c +++ b/src/common/sql.c @@ -1031,8 +1031,10 @@ void Sql_HerculesUpdateCheck(Sql* self) { continue; } - if( fgetc(ufp) != '#' ) + if( fgetc(ufp) != '#' ) { + fclose(ufp); continue; + } fseek (ufp,1,SEEK_SET);/* woo. skip the # */ -- cgit v1.2.3-60-g2f50