Browse Source

check pointer value

Check if the pointer is NULL
hansipie 10 years ago
parent
commit
8c971d1296
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/civetweb.c

+ 4 - 0
src/civetweb.c

@@ -1439,6 +1439,10 @@ static void sockaddr_to_string(char *buf, size_t len, const union usa *usa)
 {
 	buf[0] = '\0';
 
+	if (!usa) {
+		return NULL;
+	}
+	
 	if (usa->sa.sa_family == AF_INET) {
 		getnameinfo(
 		    &usa->sa, sizeof(usa->sin), buf, len, NULL, 0, NI_NUMERICHOST);