diff mbox

Fix coverity #292113

Message ID 20200419193104.22351-3-sbabic@denx.de
State Accepted
Headers show

Commit Message

Stefano Babic April 19, 2020, 7:31 p.m. UTC
Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 core/stream_interface.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox

Patch

diff --git a/core/stream_interface.c b/core/stream_interface.c
index f9a71b5..bf502e5 100644
--- a/core/stream_interface.c
+++ b/core/stream_interface.c
@@ -360,6 +360,9 @@  static int save_stream(int fdin, struct swupdate_cfg *software)
 	char output_file[MAX_IMAGE_FNAME];
 	const char* TMPDIR = get_tmpdir();
 
+	if (fdin < 0)
+		return -EINVAL;
+
 	snprintf(tmpfilename, sizeof(tmpfilename), "%s/%s", TMPDIR, SW_TMP_OUTPUT);
 
 	buf = (unsigned char *)malloc(bufsize);