diff options
| author | Marc <foxtrot@malloc.me> | 2022-01-09 16:00:19 +0000 |
|---|---|---|
| committer | Marc <foxtrot@malloc.me> | 2022-01-09 16:00:19 +0000 |
| commit | 1d9f81ab8641c5fb1f46d16081c8b320998c70ec (patch) | |
| tree | 0b131b4310ccde74d53ad07b6897c32454a640ba /src/libwifi | |
| parent | 0bd924735125b34b74c893936b89cfae02e3379d (diff) | |
| download | libwifi-1d9f81ab8641c5fb1f46d16081c8b320998c70ec.tar.gz libwifi-1d9f81ab8641c5fb1f46d16081c8b320998c70ec.tar.bz2 libwifi-1d9f81ab8641c5fb1f46d16081c8b320998c70ec.zip | |
core: Fix tag_iterator failure on empty tags.
This code used to be `< 0`, but was changed to `<= 0` in commit d40ddfe. Thinking more about this, it's a bad idea to abort on 0 length tags, since it's completely valid for some tags (such as SSID) to be empty. It doesn't make sense to check if `tag_len` is below 0, because it's unsigned. So, remove the check completely.
Diffstat (limited to 'src/libwifi')
| -rw-r--r-- | src/libwifi/core/frame/tag_iterator.c | 4 |
1 files changed, 0 insertions, 4 deletions
| diff --git a/src/libwifi/core/frame/tag_iterator.c b/src/libwifi/core/frame/tag_iterator.c index 662c2a2..0982c95 100644 --- a/src/libwifi/core/frame/tag_iterator.c +++ b/src/libwifi/core/frame/tag_iterator.c | |||
| @@ -16,14 +16,10 @@ | |||
| 16 | #include "tag_iterator.h" | 16 | #include "tag_iterator.h" |
| 17 | 17 | ||
| 18 | #include <errno.h> | 18 | #include <errno.h> |
| 19 | #include <stdio.h> | ||
| 20 | #include <string.h> | 19 | #include <string.h> |
| 21 | 20 | ||
| 22 | int libwifi_tag_iterator_init(struct libwifi_tag_iterator *it, const void *tags_start, size_t data_len) { | 21 | int libwifi_tag_iterator_init(struct libwifi_tag_iterator *it, const void *tags_start, size_t data_len) { |
| 23 | it->tag_header = (struct libwifi_tag_header *) tags_start; | 22 | it->tag_header = (struct libwifi_tag_header *) tags_start; |
| 24 | if (it->tag_header->tag_len <= 0) { | ||
| 25 | return -EINVAL; | ||
| 26 | } | ||
| 27 | 23 | ||
| 28 | it->tag_data = (unsigned char *) tags_start + sizeof(struct libwifi_tag_header); | 24 | it->tag_data = (unsigned char *) tags_start + sizeof(struct libwifi_tag_header); |
| 29 | it->_next_tag_header = (struct libwifi_tag_header *) (it->tag_data + it->tag_header->tag_len); | 25 | it->_next_tag_header = (struct libwifi_tag_header *) (it->tag_data + it->tag_header->tag_len); |
