File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -176,7 +176,12 @@ pub unsafe extern "C" fn dash_spv_ffi_config_add_peer(
176176 return FFIErrorCode :: Success as i32 ;
177177 }
178178
179- // 3) Must be a hostname - reject empty, append default port if not specified
179+ // 3) Must be a hostname - reject empty or missing hostname
180+ if addr_str. is_empty ( ) {
181+ set_last_error ( "Empty or missing hostname" ) ;
182+ return FFIErrorCode :: InvalidArgument as i32 ;
183+ }
184+
180185 let addr_with_port = if addr_str. contains ( ':' ) {
181186 addr_str. to_string ( )
182187 } else {
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ mod tests {
5959 "127.0.0.1:99999" , // port too high
6060 "127.0.0.1:-1" , // negative port
6161 ":9999" , // missing hostname
62+ ":" , // missing hostname and port
6263 ":::" , // invalid IPv6
6364 "localhost:abc" , // non-numeric port
6465 "localhost:" , // empty port
You can’t perform that action at this time.
0 commit comments