File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 1- /* $OpenBSD: misc.c,v 1.204 2025/09/02 09:34:48 djm Exp $ */
1+ /* $OpenBSD: misc.c,v 1.205 2025/09/04 00:30:06 djm Exp $ */
22/*
33 * Copyright (c) 2000 Markus Friedl. All rights reserved.
44 * Copyright (c) 2005-2020 Damien Miller. All rights reserved.
@@ -994,17 +994,18 @@ urldecode(const char *src)
994994 size_t srclen ;
995995
996996 if ((srclen = strlen (src )) >= SIZE_MAX )
997- fatal_f ( "input too large" ) ;
997+ return NULL ;
998998 ret = xmalloc (srclen + 1 );
999999 for (dst = ret ; * src != '\0' ; src ++ ) {
10001000 switch (* src ) {
10011001 case '+' :
10021002 * dst ++ = ' ' ;
10031003 break ;
10041004 case '%' :
1005+ /* note: don't allow \0 characters */
10051006 if (!isxdigit ((unsigned char )src [1 ]) ||
10061007 !isxdigit ((unsigned char )src [2 ]) ||
1007- (ch = hexchar (src + 1 )) == -1 ) {
1008+ (ch = hexchar (src + 1 )) == -1 || ch == 0 ) {
10081009 free (ret );
10091010 return NULL ;
10101011 }
You can’t perform that action at this time.
0 commit comments