Bug 780386: Fix incorrect conversion of hex digits 'A'-'F' in
authorCykesiopka <cykesiopka.bmo@gmail.com>
Mon, 06 May 2013 14:25:59 -0700
changeset 10768 0babcec0543a3b75fe54ad37c91a186d1aa0233c
parent 10767 776fced32705ef7b3f4d7bf314c4538ac8367019
child 10769 018cd55949ef889459fb318eee06091417135e87
push id77
push userwtc@google.com
push dateMon, 06 May 2013 21:26:03 +0000
bugs780386
Bug 780386: Fix incorrect conversion of hex digits 'A'-'F' in string_to_binary. r=wtc.
cmd/certcgi/certcgi.c
--- a/cmd/certcgi/certcgi.c
+++ b/cmd/certcgi/certcgi.c
@@ -1434,24 +1434,24 @@ string_to_binary(char  *string)
     }
     rv->len = 0;
     while (*string != '\0') {
 	if (isxdigit(*string)) {
 	    if (*string >= '0' && *string <= '9') {
 		high_digit = *string - '0';
 	    } else {
 		*string = toupper(*string);
-		high_digit = *string - 'A';
+		high_digit = *string - 'A' + 10;
 	    }
 	    string++;
 	    if (*string >= '0' && *string <= '9') {
 		low_digit = *string - '0';
 	    } else {
 		*string = toupper(*string);
-		low_digit = *string = 'A';
+		low_digit = *string - 'A' + 10;
 	    }
 	    (rv->len)++;
 	} else {
 	    if (*string == ':') {
 		string++;
 	    } else {
 		if (*string == ' ') {
 		    while (*string == ' ') {