Skip to content

Commit

Permalink
Merge pull request #143 from morisja/ignore_zero_port
Browse files Browse the repository at this point in the history
Getservbyport should refuse port 0
  • Loading branch information
leifwalsh authored Oct 23, 2024
2 parents f6b4edd + bd06f28 commit 2a32997
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ impl FromStr for ServiceWithPort {

impl ServiceWithPort {
fn lookup(&self) -> Result<Option<Service>> {
//issue-142
//port 0 lookups to sssd return ENOMEM
if self.port == 0 {
return Ok(None);
}
let proto = match &self.proto {
Some(p) => Some(CString::new(p.clone())?),
None => None,
Expand Down

0 comments on commit 2a32997

Please sign in to comment.