[PATCH] fix uloop initialization

2022-11-27 Thread Leon M. Busch-George
uloop_init is already called in main. uloop_done is just missing. Signed-off-by: Leon M. Busch-George --- dev.c | 2 -- main.c | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dev.c b/dev.c index bd10207..9eb7209 100644 --- a/dev.c +++ b/dev.c @@ -353,8 +353,6 @@ int

[PATCH 1/3] respect limitedness of the phy name buffer

2024-03-01 Thread Leon M. Busch-George
From: "Leon M. Busch-George" This prevents potential buffer overflows while writing to the phy name buffer buffer. Additionally, truncated data is not returned so consumers don't work with unterminated data, preventing out-of-bounds access. Sadly, consumers like lookup_phy o

memory safety with phy names

2024-03-01 Thread Leon M. Busch-George
Hi there :-) While reviewing code using libiwinfo, I noticed that are no length garantuees for the size of the phy name buffer. These patches should help making phy names easier to deal with internally. The strcpy that copies the internal buffer into the user-supplied buffer can still overflow.

[PATCH 2/3] make phy name const to signify it's static nature

2024-03-01 Thread Leon M. Busch-George
From: "Leon M. Busch-George" Typically, returning a char * signifies to callers that they own the buffer. Signed-off-by: Leon M. Busch-George --- iwinfo_nl80211.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/iwinfo_nl80211.c b/iwinfo_nl802

[PATCH 3/3] move assignment out of condition

2024-03-01 Thread Leon M. Busch-George
From: "Leon M. Busch-George" Signed-off-by: Leon M. Busch-George --- iwinfo_nl80211.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c index 8eab671..6270ef9 100644 --- a/iwinfo_nl80211.c +++ b/iwinfo_nl80211.c @@ -2031