diff options
author | Tatsuya Kinoshita <tats@debian.org> | 2018-03-04 14:54:59 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-04 14:54:59 +0000 |
commit | 4f2be7d71edba728917523ad1c5f9f5b90529106 (patch) | |
tree | b0201f1c383c856f6ac538b6e4d384e172fbcb92 /file.c | |
parent | Update ChangeLog (diff) | |
parent | Add error handling code for fopen (diff) | |
download | w3m-4f2be7d71edba728917523ad1c5f9f5b90529106.tar.gz w3m-4f2be7d71edba728917523ad1c5f9f5b90529106.zip |
Merge pull request #96 from ZhouyangJia/master
Fix crashes when some external APIs fail
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -611,8 +611,10 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu) if(w3m_reqlog){ FILE *ff; ff = fopen(w3m_reqlog, "a"); - Strfputs(tmp, ff); - fclose(ff); + if(ff){ + Strfputs(tmp, ff); + fclose(ff); + } } if (src) Strfputs(tmp, src); @@ -7580,6 +7582,8 @@ loadImageBuffer(URLFile *uf, Buffer *newBuf) tmp = Sprintf("<img src=\"%s\"><br><br>", html_quote(image.url)); tmpf = tmpfname(TMPF_SRC, ".html"); src = fopen(tmpf->ptr, "w"); + if (src == NULL) + return NULL; newBuf->mailcap_source = tmpf->ptr; init_stream(&f, SCM_LOCAL, newStrStream(tmp)); |