[gnome-boxes/gnome-3-8] get_decoded_udev_property: Fix sscanf use
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/gnome-3-8] get_decoded_udev_property: Fix sscanf use
- Date: Wed, 12 Mar 2014 16:00:57 +0000 (UTC)
commit 6dd1d6e679bc03523637a8c7a3948ac3dcb4c3cf
Author: Christophe Fergeau <cfergeau redhat com>
Date: Wed Mar 12 15:55:17 2014 +0100
get_decoded_udev_property: Fix sscanf use
sscanf man page says about %x:
'x Matches an unsigned hexadecimal integer; the next pointer must be a
pointer to unsigned int'
get_decoded_udev_property() is using %02x, but this is not documented as
reducing the size of the expected pointer, it's only documented as causing
sscanf to read at most 2 digits of the parsed number.
Boxes was passing an uint8 to scanf instead of an uint, causing memory
corruption (plus a 'fortify: stack smashing detected' message if this is
enabled when building), and eventually a crash in get_decoded_udev_property().
src/installer-media.vala | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/installer-media.vala b/src/installer-media.vala
index 7b567ab..8fc18da 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -195,7 +195,7 @@ private class Boxes.InstallerMedia : GLib.Object {
var decoded = "";
for (var i = 0; i < encoded.length; ) {
- uint8 x;
+ uint x;
if (encoded[i:encoded.length].scanf ("\\x%02x", out x) > 0) {
decoded += ((char) x).to_string ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]