Merge pull request #24578 from Luap99/addHosts-nil-deref

libpod: addHosts() prevent nil deref
This commit is contained in:
openshift-merge-bot[bot] 2024-11-18 12:59:03 +00:00 committed by GitHub
commit e1951772c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -2322,7 +2322,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: