Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib, zebra, pbrd, isisd, bgpd: fix static errors #17986

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

dmytroshytyi-6WIND
Copy link
Contributor

This PR addresses a set of fixes related to static errors in lib, zebra, pbrd, isisd, bgpd.

Each commit provides a description of the error that was present before and is attempted to be corrected.

 pnt += length;

Signed-off-by: Dmytro Shytyi <[email protected]>
…inter

[HIGH] /build/make-pkg/output/_packages/cp-routing/src/zebra/rib.h:612:6: Access to field 'status' results in a dereference of a null pointer (loaded from variable 're') [core.NullDereference]
  if (CHECK_FLAG(re->status, ROUTE_ENTRY_USE_FIB_NHG))
      ^

Found 1 defect(s) in rib.h

Signed-off-by: Dmytro Shytyi <[email protected]>
… null pointer (loaded from field 'neighbor')

threeway_state = circuit->u.p2p.neighbor->threeway_state;

Signed-off-by: Dmytro Shytyi <[email protected]>
va_end(msg->args);

Signed-off-by: Dmytro Shytyi <[email protected]>
w->sects = calloc(sizeof(PyObject *), w->ehdr->e_shnum);

Signed-off-by: Dmytro Shytyi <[email protected]>
…nc_ptr')

if (*sid_wide_func_ptr == sid_wide_func)

Signed-off-by: Dmytro Shytyi <[email protected]>
[HIGH] /build/make-pkg/output/_packages/cp-routing/src/lib/zlog.c:438:6: Access to field 'text' results in a dereference of a null pointer (loaded from variable 'msg') [core.NullDereference]
  if (msg->text && msg->text != stackbuf)

Signed-off-by: Dmytro Shytyi <[email protected]>
@@ -598,6 +598,8 @@ DECLARE_HOOK(rib_shutdown, (struct route_node * rn), (rn));
*/
static inline struct nexthop_group *rib_get_fib_nhg(struct route_entry *re)
{
if (re == NULL)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer that we figure out why a call to rib-get_fib_nhg is even possible with a null pointer instead of this fix

@@ -1938,6 +1938,11 @@ int send_hello(struct isis_circuit *circuit, int level)
size_t len_pointer;
int retval;

if (!circuit) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again.. how is send_hello called with a null pointer?

@@ -1211,7 +1211,8 @@ static bool alloc_srv6_sid_func_explicit(struct zebra_srv6_sid_block *block,
.func_allocated,
node,
sid_wide_func_ptr))
if (*sid_wide_func_ptr == sid_wide_func)
if (sid_wide_func_ptr
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this possible?

@@ -3712,10 +3712,6 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
zlog_err("%pBP: Capability length error", peer);
bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_SUBCODE_UNSPECIFIC);
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally left the pnt addition in because if we ever modified the code I wanted a reminder that the length pointer needed to be handled appropriately. Why are we removing this commented out code?

Copy link
Member

@riw777 riw777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting on @donaldsharp 's comments ... I don't see anything beyond those right now

@riw777
Copy link
Member

riw777 commented Feb 5, 2025

#10 25.75 lib/zlog.c: In function 'vzlog_notls':
#10 25.75 lib/zlog.c:450:17: error: invalid operands to binary && (have 'int' and 'va_list')
#10 25.75   450 |         if (msg && msg->args)
#10 25.75       |             ~~~ ^~ ~~~~~~~~~
#10 25.75       |             |         |
#10 25.75       |             int       va_list
#10 25.75 lib/zlog.c: In function 'zlog_msg_text':
#10 25.75 lib/zlog.c:834:21: error: used struct type value where scalar is required
#10 25.75   834 |                 if (msg->args)
#10 25.75       |                     ^~~```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants