]> git.ipfire.org Git - thirdparty/curl.git/commit
examples/http2-down/upload: add error checks
authorRadoslav Georgiev <rgeorgiev583@gmail.com>
Tue, 26 May 2020 16:42:07 +0000 (19:42 +0300)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 1 Jun 2020 22:14:08 +0000 (00:14 +0200)
commitabfd154efd5de2cc3c73ff50b9a489651fb2a5b6
tree4325c93e9f9770ecf48da82d4a3d755c0c2d2363
parent066b30323182193bd034cf86af03d3713c2004ec
examples/http2-down/upload: add error checks

If `index.html` does not exist in the directory from which the example
is invoked, the fopen(upload, "rb") invocation in `setup` would fail,
returning NULL.  This value is subsequently passed as the FILE* argument
of the `fread` invocation in the `read_callback` function, which is the
actual cause of the crash (apparently `fread` assumes that argument to
be non-null).

In addition, mitigate some possible crashes of similar origin.

Closes #5463
docs/examples/http2-download.c
docs/examples/http2-upload.c