Skip to content

Commit 3c2cfd8

Browse files
committed
fixup! Conf: use canonical textual form for IP identifiers.
1 parent 7ef429f commit 3c2cfd8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/conf/order.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,10 @@ where
254254
}
255255
}
256256

257-
/// Checks if the value is an IP address and returns a canonical representation of the address,
258-
/// reallocated on the configuration pool if necessary.
257+
/// Attempts to parse the value as an IP address, returning `Some(...)` on success.
258+
///
259+
/// The address will be converted to a canonical textual form and reallocated on the
260+
/// configuration pool if necessary.
259261
fn parse_ip_identifier(
260262
cf: &ngx_conf_t,
261263
value: &'static str,
@@ -281,6 +283,7 @@ fn parse_ip_identifier(
281283
out.try_reserve_exact(buf.len()).map_err(|_| AllocError)?;
282284
out.extend_from_slice(buf);
283285
// SAFETY: formatted IpAddr is always a valid ASCII string.
286+
// The buffer is owned by the ngx_pool_t and does not leak.
284287
let out = unsafe { core::str::from_utf8_unchecked(out.leak()) };
285288

286289
Ok(Some(out))

0 commit comments

Comments
 (0)