[glib-networking] tls: fix pkcs11-pin test to handle non-nul-terminated strings
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking] tls: fix pkcs11-pin test to handle non-nul-terminated strings
- Date: Mon, 30 Jan 2012 14:09:52 +0000 (UTC)
commit 510979d2eef4df032ff39e480891f44b947133a8
Author: Dan Winship <danw gnome org>
Date: Mon Jan 30 09:06:54 2012 -0500
tls: fix pkcs11-pin test to handle non-nul-terminated strings
g_tls_password_get_value() and p11_kit_pin_get_value() return
non-nul-terminated strings, so don't use strcmp() on them.
https://bugzilla.gnome.org/show_bug.cgi?id=668945
tls/tests/pkcs11-pin.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/tls/tests/pkcs11-pin.c b/tls/tests/pkcs11-pin.c
index d4051f9..442b3dd 100644
--- a/tls/tests/pkcs11-pin.c
+++ b/tls/tests/pkcs11-pin.c
@@ -101,13 +101,13 @@ test_set_get_value (TestPin *test,
value = g_tls_password_get_value (test->pin, &n_value);
g_assert_cmpuint (n_value, ==, 6);
- g_assert_cmpstr ((const gchar *)value, ==, "secret");
+ g_assert (!strncmp ((const gchar *)value, "secret", n_value));
g_tls_password_set_value (test->pin, (const guchar *)"other", 5);
value = g_tls_password_get_value (test->pin, &n_value);
g_assert_cmpuint (n_value, ==, 5);
- g_assert_cmpstr ((const gchar *)value, ==, "other");
+ g_assert (!strncmp ((const gchar *)value, "other", n_value));
}
static void
@@ -124,7 +124,7 @@ test_internal_pin (TestPin *test,
value = p11_kit_pin_get_value (pin, &n_value);
g_assert_cmpuint (n_value, ==, 6);
- g_assert_cmpstr ((const gchar *)value, ==, "secret");
+ g_assert (!strncmp ((const gchar *)value, "secret", n_value));
p11_kit_pin_unref (pin);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]