[msitools] Prevent null pointer dereference in memset
- From: Marc-Andre Lureau <malureau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [msitools] Prevent null pointer dereference in memset
- Date: Sun, 30 Nov 2014 19:40:01 +0000 (UTC)
commit 56738e0440e1617a90b6b76e1b6eb355601a268a
Author: Stephen Kitt <steve sk2 org>
Date: Sun Nov 30 17:49:00 2014 +0000
Prevent null pointer dereference in memset
This is copied from Wine's deb274226783ab886bdb44876944e156757efe2b
msi: Prevent call to memset with a null pointer in get_tablecolumns function.
https://bugzilla.gnome.org/show_bug.cgi?id=740901
libmsi/table.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/libmsi/table.c b/libmsi/table.c
index 895d5e0..5c207e3 100644
--- a/libmsi/table.c
+++ b/libmsi/table.c
@@ -669,7 +669,7 @@ static unsigned get_tablecolumns( LibmsiDatabase *db, const char *szTableName, L
/* Note: _Columns table doesn't have non-persistent data */
/* if maxcount is non-zero, assume it's exactly right for this table */
- memset( colinfo, 0, maxcount * sizeof(*colinfo) );
+ if (colinfo) memset( colinfo, 0, maxcount * sizeof(*colinfo) );
count = table->row_count;
for (i = 0; i < count; i++)
{
@@ -682,7 +682,7 @@ static unsigned get_tablecolumns( LibmsiDatabase *db, const char *szTableName, L
/* check the column number is in range */
if (col < 1 || col > maxcount)
{
- g_critical("column %d out of range\n", col);
+ g_critical("column %d out of range (maxcount: %d)\n", col, maxcount);
continue;
}
/* check if this column was already set */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]