cli: account for additional digit for frequencies above 10GHz
authorDaniel Golle <daniel@makrotopia.org>
Tue, 5 Jan 2021 15:09:40 +0000 (15:09 +0000)
committerDaniel Golle <daniel@makrotopia.org>
Tue, 5 Jan 2021 22:19:43 +0000 (22:19 +0000)
When using 802.11ad, the frequency string will no longer fit in the
preallocated buffer of 10 bytes. In the best case this leads to the
'z' character being truncated in the CLI output:
  Mode: Client  Channel: 1 (58.320 GH)

Fix that by allocating a large enough buffer.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
iwinfo_cli.c

index 35cc380a84b59a4daf9d2f232506dbf77b7c0aed..c052d630fced5089b509b9335d661cfe9d4be28f 100644 (file)
@@ -58,7 +58,7 @@ static char * format_channel(int ch)
 
 static char * format_frequency(int freq)
 {
-       static char buf[10];
+       static char buf[11];
 
        if (freq <= 0)
                snprintf(buf, sizeof(buf), "unknown");