[gnome-initial-setup/shell/4765: 44/362] factory-mode: make sure to UTF-8 validate the product_serial string
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup/shell/4765: 44/362] factory-mode: make sure to UTF-8 validate the product_serial string
- Date: Thu, 19 Mar 2015 01:24:45 +0000 (UTC)
commit 6608138c1598c00bc37bebac66d22bd463b702e7
Author: Cosimo Cecchi <cosimo endlessm com>
Date: Thu May 22 15:40:56 2014 -0700
factory-mode: make sure to UTF-8 validate the product_serial string
To put it into a barcode (or a label for what matters) this needs to be
valid unicode, or we'll get undefined behavior, and possibly spin in an
infinite loop trying to construct the barcode.
Just bail out in case what we read is not valid UTF-8.
[endlessm/eos-shell#2437]
.../pages/language/gis-language-page.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gnome-initial-setup/pages/language/gis-language-page.c
b/gnome-initial-setup/pages/language/gis-language-page.c
index e085e35..bfd5be4 100644
--- a/gnome-initial-setup/pages/language/gis-language-page.c
+++ b/gnome-initial-setup/pages/language/gis-language-page.c
@@ -237,6 +237,13 @@ get_serial_version (void)
return NULL;
}
+ /* ZBarcode_Encode_and_Print() needs UTF-8 */
+ if (!g_utf8_validate (serial, -1, NULL)) {
+ g_warning ("Error when reading %s: not a valid UTF-8 string", SERIAL_VERSION_FILE);
+ g_free (serial);
+ return NULL;
+ }
+
return serial;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]