From cf85a16cf48e20a319e2b26cdd7dc41ea0972528 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 5 Dec 2002 01:01:38 +0100 Subject: better fix for read_rows, same for read_one_row --- libmysql/libmysql.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'libmysql') diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 3c1353e0088..9db1e1c9ab9 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -939,7 +939,7 @@ static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields, else { cur->data[field] = to; - if (to+len > end_to) + if (len > end_to - to) { free_rows(result); net->last_errno=CR_UNKNOWN_ERROR; @@ -980,7 +980,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths) { uint field; ulong pkt_len,len; - uchar *pos,*prev_pos; + uchar *pos,*prev_pos, *end_pos; if ((pkt_len=(uint) net_safe_read(mysql)) == packet_error) return -1; @@ -988,6 +988,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths) return 1; /* End of data */ prev_pos= 0; /* allowed to write at packet[-1] */ pos=mysql->net.read_pos; + end_pos=pos+pkt_len; for (field=0 ; field < fields ; field++) { if ((len=(ulong) net_field_length(&pos)) == NULL_LENGTH) @@ -997,6 +998,12 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths) } else { + if (len > end_pos - pos) + { + mysql->net.last_errno=CR_UNKNOWN_ERROR; + strmov(mysql->net.last_error,ER(mysql->net.last_errno)); + return -1; + } row[field] = (char*) pos; pos+=len; *lengths++=len; -- cgit v1.2.1 From 49162e0e54c085ecefb6893a5bd662e4f7b2f56a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 11 Dec 2002 12:59:55 +0200 Subject: Added back -max to server name if we are using InnoDB. libmysql/libmysql.c: Compatibility fix sql/mysqld.cc: Added back -max if we are using InnoDB. (This should not be done in the 3.23 version) --- libmysql/libmysql.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libmysql') diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 9db1e1c9ab9..755d85dd04a 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -939,7 +939,7 @@ static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields, else { cur->data[field] = to; - if (len > end_to - to) + if (len > (ulong) (end_to - to)) { free_rows(result); net->last_errno=CR_UNKNOWN_ERROR; @@ -998,7 +998,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths) } else { - if (len > end_pos - pos) + if (len > (ulong) (end_pos - pos)) { mysql->net.last_errno=CR_UNKNOWN_ERROR; strmov(mysql->net.last_error,ER(mysql->net.last_errno)); -- cgit v1.2.1