[evolution-data-server/gnome-3-10] libecal: Refactor system timezone key file parsing code
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-3-10] libecal: Refactor system timezone key file parsing code
- Date: Wed, 4 Dec 2013 01:27:49 +0000 (UTC)
commit ecb7975072af5d6da6975e8aef5427cbef68f61c
Author: Philip Withnall <philip withnall collabora co uk>
Date: Fri Nov 29 08:51:11 2013 +0000
libecal: Refactor system timezone key file parsing code
Previously, the code could call g_strstrip(NULL) if a line started with
a quotation mark but didn’t end with one, e.g.:
MyKey="some-unbalanced-value
The code now ignores unbalanced quotation marks, returning the odd one
in the value rather than crashing (or stripping it).
Found by scan-build.
https://bugzilla.gnome.org/719533
(cherry picked from commit f851d77bcec88d4a2e664185ba760f9cfd08ee1f)
calendar/libecal/e-cal-system-timezone.c | 18 +++++-------------
1 files changed, 5 insertions(+), 13 deletions(-)
---
diff --git a/calendar/libecal/e-cal-system-timezone.c b/calendar/libecal/e-cal-system-timezone.c
index 8015428..78767ca 100644
--- a/calendar/libecal/e-cal-system-timezone.c
+++ b/calendar/libecal/e-cal-system-timezone.c
@@ -140,21 +140,13 @@ system_timezone_read_key_file (const gchar *filename,
len = strlen (value);
- if (value[0] == '\"') {
- if (value[len - 1] == '\"') {
- if (retval)
- g_free (retval);
-
- retval = g_strndup (
- value + 1, len - 2);
- }
- } else {
- if (retval)
- g_free (retval);
-
- retval = g_strdup (line + strlen (key_eq));
+ if (value[0] == '\"' && value[len - 1] == '\"') {
+ value += 1;
+ len -= 2;
}
+ g_free (retval);
+ retval = g_strndup (value, len);
g_strstrip (retval);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]