]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
rlm_sql_freetds: handle returned NULL column values
authorNick Porter <nick@portercomputing.co.uk>
Mon, 1 Apr 2024 17:33:20 +0000 (18:33 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Mon, 1 Apr 2024 17:37:10 +0000 (18:37 +0100)
These don't update the results buffer - so zero it out during
allocation.

src/modules/rlm_sql/drivers/rlm_sql_freetds/rlm_sql_freetds.c

index 65d1b86fad8148bcc5f4f721224e7e5ab0334c16..79bb8e20596127214fdbefce24aed84675523aef 100644 (file)
@@ -511,7 +511,7 @@ static sql_rcode_t sql_select_query(rlm_sql_handle_t *handle, rlm_sql_config_t c
 
                        for (i = 0; i < colcount; i++) {
                                /* Space to hold the result data */
-                               rowdata[i] = talloc_array(rowdata, char, MAX_DATASTR_LEN + 1);
+                               rowdata[i] = talloc_zero_array(rowdata, char, MAX_DATASTR_LEN + 1);
 
                                /* Associate the target buffer with the data */
                                if (ct_bind(conn->command, i + 1, &descriptor, rowdata[i], NULL, NULL) != CS_SUCCEED) {