Skip to content

Commit

Permalink
pbrd: fix null pointer deref when showing ifaces
Browse files Browse the repository at this point in the history
If there are no PBR interfaces configured and we do a 'show run', pbrd
crashes with a NPD when it tries to dereference ifp->info.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
  • Loading branch information
qlyoung authored and donaldsharp committed Mar 20, 2018
1 parent c89d83e commit 21593eb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pbrd/pbr_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ void pbr_map_write_interfaces(struct vty *vty, struct interface *ifp)
{
struct pbr_interface *pbr_ifp = ifp->info;

if (!(strcmp(pbr_ifp->mapname, "") == 0))
if (pbr_ifp
&& strncmp(pbr_ifp->mapname, "", sizeof(pbr_ifp->mapname)) != 0)
vty_out(vty, " pbr-policy %s\n", pbr_ifp->mapname);
}

Expand Down

0 comments on commit 21593eb

Please sign in to comment.