diff options
-rw-r--r-- | include/dns.h | 1 | ||||
-rw-r--r-- | src/configreader.cpp | 21 | ||||
-rw-r--r-- | src/dns.cpp | 6 | ||||
-rw-r--r-- | src/wildcard.cpp | 2 |
4 files changed, 21 insertions, 9 deletions
diff --git a/include/dns.h b/include/dns.h index 4a1335cc7..3295e29e3 100644 --- a/include/dns.h +++ b/include/dns.h @@ -104,6 +104,7 @@ typedef requestlist::iterator requestlist_iter; */ enum QueryType { + DNS_QUERY_NONE = 0, /* Uninitialized Query */ DNS_QUERY_A = 1, /* 'A' record: an ipv4 address */ DNS_QUERY_CNAME = 5, /* 'CNAME' record: An alias */ DNS_QUERY_PTR = 12, /* 'PTR' record: a hostname */ diff --git a/src/configreader.cpp b/src/configreader.cpp index c854d2ec4..71fd9e6b9 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -1310,7 +1310,7 @@ int ServerConfig::ConfVarEnum(ConfigDataHash &target, const std::string &tag, in */ bool ServerConfig::ReadFile(file_cache &F, const char* fname) { - FILE* file; + FILE* file = NULL; char linebuf[MAXBUF]; F.clear(); @@ -1334,8 +1334,10 @@ bool ServerConfig::ReadFile(file_cache &F, const char* fname) { while (!feof(file)) { - fgets(linebuf, sizeof(linebuf), file); - linebuf[strlen(linebuf)-1] = 0; + if (fgets(linebuf, sizeof(linebuf), file)) + linebuf[strlen(linebuf)-1] = 0; + else + *linebuf = 0; if (!feof(file)) { @@ -1399,12 +1401,14 @@ bool ServerConfig::DirValid(const char* dirandfile) if (getcwd(buffer, MAXBUF ) == NULL ) return false; - chdir(work); + if (chdir(work) == -1) + return false; if (getcwd(otherdir, MAXBUF ) == NULL ) return false; - chdir(buffer); + if (chdir(buffer) == -1) + return false; size_t t = strlen(work); @@ -1451,12 +1455,15 @@ std::string ServerConfig::GetFullProgDir(char** argv, int argc) if (getcwd(buffer, MAXBUF) == NULL) return ""; - chdir(work); + if (chdir(work) == -1) + return ""; if (getcwd(otherdir, MAXBUF) == NULL) return ""; - chdir(buffer); + if (chdir(buffer) == -1) + return ""; + return otherdir; } diff --git a/src/dns.cpp b/src/dns.cpp index 23e1dfcab..0e0f32874 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -731,7 +731,11 @@ DNSInfo DNSRequest::ResultIsReady(DNSHeader &header, int length) int curanswer, o; ResourceRecord rr; unsigned short ptr; - + + /* This is just to keep _FORTIFY_SOURCE happy */ + rr.type = DNS_QUERY_NONE; + rr.rdlength = 0; + if (!(header.flags1 & FLAGS_MASK_QR)) return std::make_pair((unsigned char*)NULL,"Not a query result"); diff --git a/src/wildcard.cpp b/src/wildcard.cpp index eacffcb04..57b1bab48 100644 --- a/src/wildcard.cpp +++ b/src/wildcard.cpp @@ -35,7 +35,7 @@ using irc::sockets::MatchCIDR; bool match(const char *str, const char *mask) { - unsigned char *cp, *mp; + unsigned char *cp = NULL, *mp = NULL; unsigned char* string = (unsigned char*)str; unsigned char* wild = (unsigned char*)mask; |