41 lines
1.4 KiB
Diff
41 lines
1.4 KiB
Diff
|
From 583d9cccdbd5fbd32c7faa67be7722002c6665b3 Mon Sep 17 00:00:00 2001
|
||
|
From: Stef Walter <stefw@gnome.org>
|
||
|
Date: Fri, 11 Jan 2013 20:48:23 +0000
|
||
|
Subject: egg-armor: Handle mismatched but not truncated suffix line
|
||
|
|
||
|
* Discovered by Gustavo Luiz Duarte <gustavold@linux.vnet.ibm.com>
|
||
|
|
||
|
https://bugzilla.gnome.org/show_bug.cgi?id=691500
|
||
|
---
|
||
|
diff --git a/egg/egg-armor.c b/egg/egg-armor.c
|
||
|
index 7c788ad..acb56df 100644
|
||
|
--- a/egg/egg-armor.c
|
||
|
+++ b/egg/egg-armor.c
|
||
|
@@ -173,7 +173,7 @@ armor_find_end (const gchar *data,
|
||
|
at += n_type;
|
||
|
|
||
|
/* Next comes the suffix */
|
||
|
- if (ARMOR_SUFF_L > len && strncmp ((gchar*)at, ARMOR_SUFF, ARMOR_SUFF_L) != 0)
|
||
|
+ if (ARMOR_SUFF_L > len || strncmp ((gchar *)at, ARMOR_SUFF, ARMOR_SUFF_L) != 0)
|
||
|
return NULL;
|
||
|
|
||
|
/*
|
||
|
diff --git a/egg/tests/test-armor.c b/egg/tests/test-armor.c
|
||
|
index d5a366b..7435a10 100644
|
||
|
--- a/egg/tests/test-armor.c
|
||
|
+++ b/egg/tests/test-armor.c
|
||
|
@@ -148,6 +148,11 @@ main (int argc, char **argv)
|
||
|
g_test_add_data_func ("/armor/invalid-suffix",
|
||
|
"-----BEGIN TEST-----\n"
|
||
|
"Z29vZCBtb3JuaW5nIGV2ZXJ5b25lCg==\n"
|
||
|
+ "-----END TEST--xxxxxxxx\n",
|
||
|
+ test_invalid);
|
||
|
+ g_test_add_data_func ("/armor/invalid-truncated",
|
||
|
+ "-----BEGIN TEST-----\n"
|
||
|
+ "Z29vZCBtb3JuaW5nIGV2ZXJ5b25lCg==\n"
|
||
|
"-----END TEST--\n",
|
||
|
test_invalid);
|
||
|
|
||
|
--
|
||
|
cgit v0.9.0.2
|