[gnome-bluetooth] Add another check in bluetooth_verify_address()



commit 8034801c224f7f4eeebe4489e3ad04d8ecc1e74e
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Jun 10 16:46:38 2009 +0100

    Add another check in bluetooth_verify_address()
    
    Also check the length of each of the elements
---
 lib/bluetooth-client.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index fdd1215..59a377e 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -25,6 +25,7 @@
 #include <config.h>
 #endif
 
+#include <string.h>
 #include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
 
@@ -156,7 +157,9 @@ bluetooth_verify_address (const char *bdaddr)
 		return FALSE;
 	}
 	for (i = 0; i < 6; i++) {
-		if (g_ascii_isxdigit (elems[i][0]) == FALSE || g_ascii_isxdigit (elems[i][1]) == FALSE) {
+		if (strlen (elems[i]) != 2 ||
+		    g_ascii_isxdigit (elems[i][0]) == FALSE ||
+		    g_ascii_isxdigit (elems[i][1]) == FALSE) {
 			retval = FALSE;
 			break;
 		}



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