diff options
-rw-r--r-- | net/ax25/ax25_addr.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/ax25/ax25_addr.c b/net/ax25/ax25_addr.c index 9162409..e7c9b0e 100644 --- a/net/ax25/ax25_addr.c +++ b/net/ax25/ax25_addr.c @@ -189,8 +189,10 @@ const unsigned char *ax25_addr_parse(const unsigned char *buf, int len, digi->ndigi = 0; while (!(buf[-1] & AX25_EBIT)) { - if (d >= AX25_MAX_DIGIS) return NULL; /* Max of 6 digis */ - if (len < 7) return NULL; /* Short packet */ + if (d >= AX25_MAX_DIGIS) + return NULL; + if (len < AX25_ADDR_LEN) + return NULL; memcpy(&digi->calls[d], buf, AX25_ADDR_LEN); digi->ndigi = d + 1; |