Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 18af43a4 authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Address Coverity defects.

parent f650a5ed
...@@ -971,6 +971,9 @@ char* read_diz(const char* path, struct sauce_charinfo* sauce) ...@@ -971,6 +971,9 @@ char* read_diz(const char* path, struct sauce_charinfo* sauce)
memset(sauce, 0, sizeof(*sauce)); memset(sauce, 0, sizeof(*sauce));
off_t len = flength(path); off_t len = flength(path);
if(len < 1)
return NULL;
FILE* fp = fopen(path, "rb"); FILE* fp = fopen(path, "rb");
if(fp == NULL) if(fp == NULL)
return NULL; return NULL;
...@@ -982,13 +985,15 @@ char* read_diz(const char* path, struct sauce_charinfo* sauce) ...@@ -982,13 +985,15 @@ char* read_diz(const char* path, struct sauce_charinfo* sauce)
len = LEN_EXTDESC; len = LEN_EXTDESC;
char* buf = calloc((size_t)len + 1, 1); char* buf = calloc((size_t)len + 1, 1);
if(buf != NULL) if(buf != NULL) {
fread(buf, (size_t)len, 1, fp); size_t rd = fread(buf, 1, (size_t)len, fp);
buf[rd] = 0;
char* eof = strchr(buf, CTRL_Z); // CP/M EOF
if(eof != NULL)
*eof = '\0';
}
fclose(fp); fclose(fp);
char* eof = strchr(buf, CTRL_Z); // CP/M EOF
if(eof != NULL)
*eof = '\0';
return buf; return buf;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment