Explorar el Código

check pointer value

Check if the pointer is NULL
hansipie hace 10 años
padre
commit
8c971d1296
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  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);