shithub: riscv

Download patch

ref: b296b96c688a4297047e5dec33d411ed6366b6c3
parent: b142e2a30883e78c3c7ae40762a607cef1dd40b9
author: cinap_lenrek <[email protected]>
date: Tue Dec 4 05:52:42 EST 2012

devssl: handle bad secretin/secretout ctl arguments (import from sources)

--- a/sys/src/9/port/devssl.c
+++ b/sys/src/9/port/devssl.c
@@ -1186,6 +1186,10 @@
 		m = (strlen(p)*3)/2;
 		x = smalloc(m);
 		t = dec64(x, m, p, strlen(p));
+		if(t <= 0){
+			free(x);
+			error(Ebadarg);
+		}
 		setsecret(&s->in, x, t);
 		free(x);
 	} else if(strcmp(buf, "secretout") == 0 && p != 0) {
@@ -1192,6 +1196,10 @@
 		m = (strlen(p)*3)/2 + 1;
 		x = smalloc(m);
 		t = dec64(x, m, p, strlen(p));
+		if(t <= 0){
+			free(x);
+			error(Ebadarg);
+		}
 		setsecret(&s->out, x, t);
 		free(x);
 	} else