Terminate buffers!

This commit is contained in:
Eliot Gable 2012-10-08 22:48:26 +00:00
parent e5ddafff1f
commit f059d97ff8
1 changed files with 2 additions and 0 deletions

View File

@ -629,10 +629,12 @@ SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_handle_callback_exec_detailed
if (tmp) {
len = strlen(tmp);
names[col] = malloc(len+1);
names[col][len] = '\0';
strncpy(names[col], tmp, len);
len = PQgetlength(result->result, row, col);
vals[col] = malloc(len+1);
vals[col][len] = '\0';
tmp = PQgetvalue(result->result, row, col);
strncpy(vals[col], tmp, len);
} else {