shithub: riscv

Download patch

ref: 32665f51c7f5637e96fa0713584493e7060a8e98
parent: 9d15403fda575ab73c5501970fe3835265b05aee
author: cinap_lenrek <[email protected]>
date: Sun Oct 31 08:40:47 EDT 2021

libsec: no point in checking for "xn--" marker, just call idn2utf().

--- a/sys/src/libsec/port/x509.c
+++ b/sys/src/libsec/port/x509.c
@@ -141,6 +141,10 @@
 #define CLASS_MASK 0xC0
 #define MAXOBJIDLEN 20
 
+enum {
+	Domlen = 256,
+};
+
 static int ber_decode(uchar** pp, uchar* pend, Elem* pelem);
 static int tag_decode(uchar** pp, uchar* pend, Tag* ptag, int* pisconstr);
 static int length_decode(uchar** pp, uchar* pend, int* plength);
@@ -2268,8 +2272,7 @@
 		}
 		strncpy(name, subject, i);
 	}
-	if(strncmp(subject+i, "xn--", 4) != 0
-	|| idn2utf(subject+i, name+i, nname-i) < 0){
+	if(idn2utf(subject+i, name+i, nname-i) < 0){
 botch:
 		strncpy(name+i, subject+i, nname-i);
 	}
@@ -2618,7 +2621,7 @@
 static Elem
 mkaltname(char *s)
 {
-	char buf[256], *at;
+	char buf[Domlen], *at;
 	Elem e;
 	int i;
 
@@ -2734,7 +2737,7 @@
 	Elem eext, ealt, edn;
 	Elist *el, *l;
 	Ints *oid;
-	char *alt, *e, buf[256];
+	char *alt, *e, buf[Domlen];
 	int len;
 
 	if(name == nil || nname < 1 || ext == nil)