Skip to content

Commit 6ba9306

Browse files
committed
Fix: init var that's otherwise accessed uninit'd (#207)
This commit initializes a variable ("format") that can be read uninitialized. There are no negative manifestations of this issue. The var carries the type of time format that has been detected when parssing a string input value, which would subsequently be converted to a TIME/DATE/TIMESTAMP data type. In case the source is a string representing a TIMESTAMP and the destination a DATE, the representation of the destination is obtained from the original input, by zero-ing the time part (since this is how DATEs are represented in ES/SQL) and the "format" var decides, in a disjunction with another variable, on this action. In case the source is of the type DATE and the destination also a DATE, the "format" var would not be set, but its value read. In the case the random value the var can take matches the condition, a zero'ing of an already zero'd string would happen, with no other side-effect. (cherry picked from commit d1392c7)
1 parent a5d8cad commit 6ba9306

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

driver/convert.c

+1
Original file line numberDiff line numberDiff line change
@@ -4387,6 +4387,7 @@ SQLRETURN c2sql_date_time(esodbc_rec_st *arec, esodbc_rec_st *irec,
43874387
return ret;
43884388
}
43894389

4390+
format = 0;
43904391
/*INDENT-OFF*/
43914392
switch ((ctype = get_rec_c_type(arec, irec))) {
43924393
case SQL_C_CHAR:

0 commit comments

Comments
 (0)