Avoid false static analyzer warning on impossible snprintf() error path
Explicitly check that snprintf() return value is not negative to silence
a static analyzer. This call cannot fail, but it is simpler to do this
than try to figure out other ways of getting rid of false warnings.
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
diff --git a/atheros.c b/atheros.c
index 6367427..6b1eadc 100644
--- a/atheros.c
+++ b/atheros.c
@@ -44,6 +44,8 @@
return -2;
i = snprintf(resp, sizeof(resp), "resp,");
+ if (i < 0)
+ return -2;
pos = buf;
while (*pos && i + 1 < (int) sizeof(resp)) {
char c = *pos++;