summaryrefslogtreecommitdiffhomepage
path: root/lib/nl80211.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-09-22 09:13:00 +0200
committerJo-Philipp Wich <jo@mein.io>2021-09-22 09:46:18 +0200
commit137428f06f79fa0c621d5c0db86f2df565653b10 (patch)
tree672abd8473a5d977422d27d022b5ffa0d96601b6 /lib/nl80211.c
parentb9d4f61bce3b772a3965b2957529f40b86de17e7 (diff)
nl80211: fix issues spotted by static code analyzer
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'lib/nl80211.c')
-rw-r--r--lib/nl80211.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/nl80211.c b/lib/nl80211.c
index 446233c..0352eab 100644
--- a/lib/nl80211.c
+++ b/lib/nl80211.c
@@ -50,7 +50,7 @@ static struct {
char *msg;
} last_error;
-static void
+__attribute__((format(printf, 2, 3))) static void
set_error(int errcode, const char *fmt, ...) {
va_list ap;
@@ -1152,6 +1152,9 @@ uc_nl_parse_rta_nested(const uc_nl_attr_spec_t *spec, struct nl_msg *msg, char *
const uc_nl_nested_spec_t *nest = spec->auxdata;
struct nlattr *nested_nla;
+ if (!nest)
+ return false;
+
nested_nla = nla_reserve(msg, spec->attr, nest->headsize);
if (!uc_nl_parse_attrs(msg, nla_data(nested_nla), nest->attrs, nest->nattrs, vm, val))
@@ -1169,6 +1172,9 @@ uc_nl_convert_rta_nested(const uc_nl_attr_spec_t *spec, struct nl_msg *msg, stru
uc_value_t *nested_obj;
bool rv;
+ if (!nest)
+ return NULL;
+
if (!nla_check_len(tb[spec->attr], nest->headsize))
return NULL;
@@ -1483,6 +1489,7 @@ uc_nl_parse_numval(const uc_nl_attr_spec_t *spec, struct nl_msg *msg, char *base
static const uint8_t dt_sizes[] = {
[DT_U8] = sizeof(uint8_t),
+ [DT_S8] = sizeof(int8_t),
[DT_U16] = sizeof(uint16_t),
[DT_U32] = sizeof(uint32_t),
[DT_S32] = sizeof(int32_t),