mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 09:24:07 +03:00
Fixed access to freed memory in conn_get_isolation_level().
Bug reported by Anton Kovalev.
This commit is contained in:
parent
850cd97ab3
commit
baf65a0dda
|
@ -1,3 +1,8 @@
|
||||||
|
2010-10-08 Daniele Varrazzo <daniele.varrazzo@gmail.com>
|
||||||
|
|
||||||
|
* psycopg/connection_int.c: Fixed access to freed memory in
|
||||||
|
conn_get_isolation_level(). Bug reported by Anton Kovalev.
|
||||||
|
|
||||||
2010-10-05 Daniele Varrazzo <daniele.varrazzo@gmail.com>
|
2010-10-05 Daniele Varrazzo <daniele.varrazzo@gmail.com>
|
||||||
|
|
||||||
* psycopg/cursor_type.c: Common code in execute() and mogrify() merged.
|
* psycopg/cursor_type.c: Common code in execute() and mogrify() merged.
|
||||||
|
|
|
@ -217,15 +217,19 @@ conn_get_isolation_level(PGresult *pgres)
|
||||||
{
|
{
|
||||||
static const char lvl1a[] = "read uncommitted";
|
static const char lvl1a[] = "read uncommitted";
|
||||||
static const char lvl1b[] = "read committed";
|
static const char lvl1b[] = "read committed";
|
||||||
char *isolation_level = PQgetvalue(pgres, 0, 0);
|
int rv;
|
||||||
|
|
||||||
CLEARPGRES(pgres);
|
char *isolation_level = PQgetvalue(pgres, 0, 0);
|
||||||
|
|
||||||
if ((strncmp(lvl1a, isolation_level, strlen(isolation_level)) == 0)
|
if ((strncmp(lvl1a, isolation_level, strlen(isolation_level)) == 0)
|
||||||
|| (strncmp(lvl1b, isolation_level, strlen(isolation_level)) == 0))
|
|| (strncmp(lvl1b, isolation_level, strlen(isolation_level)) == 0))
|
||||||
return 1;
|
rv = 1;
|
||||||
else /* if it's not one of the lower ones, it's SERIALIZABLE */
|
else /* if it's not one of the lower ones, it's SERIALIZABLE */
|
||||||
return 2;
|
rv = 2;
|
||||||
|
|
||||||
|
CLEARPGRES(pgres);
|
||||||
|
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in New Issue
Block a user