cdr_pgsql: Fix buffer overflow calling libpq

Implement the same buffer size checking done in cel_pgsql.

ASTERISK-26896 #close
Reported by: twisted

Change-Id: Iaacfa1f1de7cb1e9414d121850d2d8c2888f3f48
This commit is contained in:
Sean Bright
2017-03-30 09:11:46 -04:00
parent 1d1309b1ed
commit 754e99d517
2 changed files with 37 additions and 23 deletions

View File

@@ -325,6 +325,7 @@ static void pgsql_log(struct ast_event *event)
char *tmpbuf = ast_realloc(escapebuf, required_size);
if (!tmpbuf) {
AST_RWLIST_UNLOCK(&psql_columns);
goto ast_log_cleanup;
}
@@ -385,8 +386,6 @@ static void pgsql_log(struct ast_event *event)
ast_log(LOG_ERROR, "Reason: %s\n", pgerror);
}
}
PQclear(result);
goto ast_log_cleanup;
}
PQclear(result);