From 491f0f606859393335f0304b15c6ff27f6e79eeb Mon Sep 17 00:00:00 2001 From: Andy Green Date: Fri, 14 Aug 2020 09:07:27 +0100 Subject: [PATCH] coverity: 324943: confirm get_random worked In normal systems this doesn't have a way to fail. But check it for consistency. --- lib/roles/http/client/client-http.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/roles/http/client/client-http.c b/lib/roles/http/client/client-http.c index 1784bc6ce..93c73a79a 100644 --- a/lib/roles/http/client/client-http.c +++ b/lib/roles/http/client/client-http.c @@ -1016,7 +1016,10 @@ lws_http_multipart_headers(struct lws *wsi, uint8_t *p) char buf[10], arg[48]; int n; - lws_get_random(wsi->a.context, (uint8_t *)buf, sizeof(buf)); + if (lws_get_random(wsi->a.context, (uint8_t *)buf, sizeof(buf)) != + sizeof(buf)) + return NULL; + lws_b64_encode_string(buf, sizeof(buf), wsi->http.multipart_boundary, sizeof(wsi->http.multipart_boundary));