mirror of
https://github.com/containers/podman.git
synced 2025-05-17 15:18:43 +08:00
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:
@ -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
|
||||
|
@ -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:
|
||||
|
Reference in New Issue
Block a user