]> 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 15:22:34 +0000 (16:22 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Mon, 20 May 2024 07:14:13 +0000 (08:14 +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 a5c3b937e8da84a872a712cf355deddc18a4dbf5..da7d7fcc65aec7b2fa61021e4beb908ea8700f96 100644 (file)
@@ -458,7 +458,7 @@ static sql_rcode_t sql_select_query(rlm_sql_handle_t *handle, rlm_sql_config_t *
 
                        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) {