[network-manager-applet/NMA_0_8] eap: make DER certificate checking code endian-safe



commit c2e4d8e0161ec156084e4cfd675dac1408e00f30
Author: Dan Williams <dcbw redhat com>
Date:   Wed Mar 2 23:59:43 2011 -0600

    eap: make DER certificate checking code endian-safe

 src/wireless-security/eap-method.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
---
diff --git a/src/wireless-security/eap-method.c b/src/wireless-security/eap-method.c
index 7e8f970..ba9ded0 100644
--- a/src/wireless-security/eap-method.c
+++ b/src/wireless-security/eap-method.c
@@ -483,7 +483,6 @@ file_is_der_or_pem (const char *filename,
 	int fd;
 	unsigned char buffer[8192];
 	ssize_t bytes_read;
-	guint16 der_tag = 0x8230;
 	gboolean success = FALSE;
 	gboolean encrypted = FALSE;
 
@@ -497,7 +496,7 @@ file_is_der_or_pem (const char *filename,
 	buffer[bytes_read] = '\0';
 
 	/* Check for DER signature */
-	if (!memcmp (buffer, &der_tag, 2)) {
+	if (bytes_read > 2 && buffer[0] == 0x30 && buffer[1] == 0x82) {
 		success = TRUE;
 		goto out;
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]