소스 검색

check pointer value

Check if the pointer is NULL
hansipie 10 년 전
부모
커밋
8c971d1296
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  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);