[msitools] Only set property type once it’s safe
- From: Marc-Andre Lureau <malureau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [msitools] Only set property type once it’s safe
- Date: Mon, 24 Jul 2017 09:02:07 +0000 (UTC)
commit 4bdbe225d10f06e8f9442c0213edd78bd4a13ab2
Author: Stephen Kitt <steve sk2 org>
Date: Thu Jul 20 21:34:08 2017 +0200
Only set property type once it’s safe
Setting the property type before we know the property is valid leaves
libmsi vulnerable to invalid frees: a bad string property sets the
type, then we notice the string is invalid, and during clean-up
attempt to free an invalid pointer.
Crash discovered by Jakub Wilk, https://bugs.debian.org/869082
Signed-off-by: Stephen Kitt <steve sk2 org>
libmsi/libmsi-summary-info.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/libmsi/libmsi-summary-info.c b/libmsi/libmsi-summary-info.c
index 081b50c..8ac6b33 100644
--- a/libmsi/libmsi-summary-info.c
+++ b/libmsi/libmsi-summary-info.c
@@ -353,7 +353,6 @@ static void read_properties_from_data( LibmsiOLEVariant *prop, const uint8_t *da
break;
}
- property->vt = proptype;
switch(proptype)
{
case OLEVT_I2:
@@ -409,6 +408,9 @@ static void read_properties_from_data( LibmsiOLEVariant *prop, const uint8_t *da
g_critical("invalid type \n");
break;
}
+
+ /* Now we now the type is valid, store it */
+ property->vt = proptype;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]