Merge pull request #24594 from openshift-cherrypick-robot/cherry-pick-24578-to-v5.3

[v5.3] libpod: addHosts() prevent nil deref
This commit is contained in:
openshift-merge-bot[bot]
2024-11-18 13:43:05 +00:00
committed by GitHub
2 changed files with 2 additions and 2 deletions

View File

@ -2323,7 +2323,7 @@ func (c *Container) addHosts() error {
// not be routed to the host.
// https://github.com/containers/podman/issues/22653
info, err := c.runtime.network.RootlessNetnsInfo()
if err == nil {
if err == nil && info != nil {
exclude = info.IPAddresses
if len(info.MapGuestIps) > 0 {
// we used --map-guest-addr to setup pasta so prefer this address

View File

@ -624,7 +624,7 @@ func (c *Container) addSpecialDNS(nameservers []string) []string {
switch {
case c.config.NetMode.IsBridge():
info, err := c.runtime.network.RootlessNetnsInfo()
if err == nil {
if err == nil && info != nil {
nameservers = append(nameservers, info.DnsForwardIps...)
}
case c.pastaResult != nil: