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 91531c3e authored by Rob Swindell's avatar Rob Swindell 💬

Resolve more Coverity issues

parent faac4653
...@@ -2749,7 +2749,7 @@ js_listening_socket_constructor(JSContext *cx, uintN argc, jsval *arglist) ...@@ -2749,7 +2749,7 @@ js_listening_socket_constructor(JSContext *cx, uintN argc, jsval *arglist)
uint16_t port; uint16_t port;
jsrefcount rc; jsrefcount rc;
scfg_t *scfg; scfg_t *scfg;
struct xpms_set *set; struct xpms_set *set = NULL;
struct ls_cb_data cb; struct ls_cb_data cb;
jsuint count; jsuint count;
int i; int i;
......
...@@ -854,6 +854,7 @@ js_uifc_list(JSContext *cx, uintN argc, jsval *arglist) ...@@ -854,6 +854,7 @@ js_uifc_list(JSContext *cx, uintN argc, jsval *arglist)
return(JS_FALSE); return(JS_FALSE);
for(; argn<argc; argn++) { for(; argn<argc; argn++) {
if(JSVAL_IS_STRING(argv[argn])) { if(JSVAL_IS_STRING(argv[argn])) {
free(title);
JSVALUE_TO_MSTRING(cx, argv[argn], title, NULL); JSVALUE_TO_MSTRING(cx, argv[argn], title, NULL);
HANDLE_PENDING(cx, title); HANDLE_PENDING(cx, title);
continue; continue;
......
...@@ -3522,6 +3522,7 @@ sbbs_t::sbbs_t(ushort node_num, union xp_sockaddr *addr, size_t addr_len, const ...@@ -3522,6 +3522,7 @@ sbbs_t::sbbs_t(ushort node_num, union xp_sockaddr *addr, size_t addr_len, const
getstr_offset = 0; getstr_offset = 0;
lastnodemsg = 0; lastnodemsg = 0;
xtrn_mode = 0; xtrn_mode = 0;
last_ns_time = 0;
} }
//**************************************************************************** //****************************************************************************
......
...@@ -135,7 +135,7 @@ uint getsub(void) ...@@ -135,7 +135,7 @@ uint getsub(void)
opt[k][0]=0; opt[k][0]=0;
sprintf(str,"Select %s Sub-board",cfg.grp[i]->sname); sprintf(str,"Select %s Sub-board",cfg.grp[i]->sname);
j=uifc.list(WIN_RHT|WIN_BOT|WIN_SAV,0,0,45,&sub_dflt,&sub_bar,str,opt); j=uifc.list(WIN_RHT|WIN_BOT|WIN_SAV,0,0,45,&sub_dflt,&sub_bar,str,opt);
if(j==-1 || j >= cfg.total_subs) if(j==-1 || j >= k)
continue; continue;
sub_dflt++; sub_dflt++;
sub_bar++; sub_bar++;
......
...@@ -632,14 +632,24 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *subj, long mode, ...@@ -632,14 +632,24 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *subj, long mode,
return(false); return(false);
} }
length=(long)filelength(file); length=(long)filelength(file);
if(length < 0) {
errormsg(WHERE, ERR_LEN, msgtmp, length);
free(buf);
return false;
}
l=strlen((char *)buf); /* reserve space for top and terminating null */ l=strlen((char *)buf); /* reserve space for top and terminating null */
/* truncate if too big */ /* truncate if too big */
if(length>(long)((cfg.level_linespermsg[useron_level]*MAX_LINE_LEN)-(l+1))) { if(length>(long)((cfg.level_linespermsg[useron_level]*MAX_LINE_LEN)-(l+1))) {
length=(cfg.level_linespermsg[useron_level]*MAX_LINE_LEN)-(l+1); length=(cfg.level_linespermsg[useron_level]*MAX_LINE_LEN)-(l+1);
bputs(text[OutOfBytes]); bputs(text[OutOfBytes]);
} }
lread(file,buf+l,length); long rd = read(file,buf+l,length);
close(file); close(file);
if(rd != length) {
errormsg(WHERE, ERR_READ, msgtmp, length);
free(buf);
return false;
}
// remove(msgtmp); /* no need to save the temp input file */ // remove(msgtmp); /* no need to save the temp input file */
buf[l+length]=0; buf[l+length]=0;
} }
...@@ -845,7 +855,7 @@ void sbbs_t::removeline(char *str, char *str2, char num, char skip) ...@@ -845,7 +855,7 @@ void sbbs_t::removeline(char *str, char *str2, char num, char skip)
errormsg(WHERE,ERR_ALLOC,str,flen); errormsg(WHERE,ERR_ALLOC,str,flen);
return; return;
} }
if(lread(file,buf,flen)!=flen) { if(read(file,buf,flen)!=flen) {
close(file); close(file);
errormsg(WHERE,ERR_READ,str,flen); errormsg(WHERE,ERR_READ,str,flen);
free(buf); free(buf);
......
...@@ -133,6 +133,7 @@ struct xpmapping* DLLCALL xpmap(const char *filename, enum xpmap_type type) ...@@ -133,6 +133,7 @@ struct xpmapping* DLLCALL xpmap(const char *filename, enum xpmap_type type)
ret=(struct xpmapping *)malloc(sizeof(struct xpmapping)); ret=(struct xpmapping *)malloc(sizeof(struct xpmapping));
if(ret==NULL) { if(ret==NULL) {
CloseHandle(md); CloseHandle(md);
UnmapViewOfFile(addr);
return NULL; return NULL;
} }
ret->addr=addr; ret->addr=addr;
......
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