소스 검색

db_postgres: memset vars to 0 to avoid using invalid values inside db_postgres_new_connection()

- reported by mading087, GH#292
Daniel-Constantin Mierla 10 년 전
부모
커밋
a16c6108e1
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      modules/db_postgres/km_pg_con.c

+ 4 - 0
modules/db_postgres/km_pg_con.c

@@ -71,6 +71,10 @@ struct pg_con* db_postgres_new_connection(struct db_id* id)
 	memset(ptr, 0, sizeof(struct pg_con));
 	ptr->ref = 1;
 
+	memset(keywords, 0, (sizeof(char*) * 10));
+	memset(values, 0, (sizeof(char*) * 10));
+	memset(to, 0, (sizeof(char) * 16));
+
 	if (id->port) {
 		ports = int2str(id->port, 0);
 		keywords[i] = "port";