A priori URI is not NUL terminated, so we should first check it is long
enough before comparing it against proto. As a side effect, this now
rejects "https://" and "rsync://", which are invalid due to the missing
host in the authority section.
ok claudio
-/* $OpenBSD: validate.c,v 1.45 2022/09/03 14:41:47 job Exp $ */
+/* $OpenBSD: validate.c,v 1.46 2022/11/02 11:28:36 tb Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
if (proto != NULL) {
s = strlen(proto);
+ if (s >= usz)
+ return 0;
if (strncasecmp(uri, proto, s) != 0)
return 0;
}