----==_mimepart_6adf4c5fd5c7a_121aef2b1c6f8d19ac1572d
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi,
Please find the latest report on new defect(s) introduced to Synchronet found with Coverity Scan.
5 new defect(s) introduced to Synchronet found with Coverity Scan.
3 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan.
New defect(s) Reported-by: Coverity Scan
Showing 5 of 5 defect(s)
** CID 661079: Error handling issues (CHECKED_RETURN)
/pack_rep.cpp: 114 in sbbs_t::pack_rep(unsigned int, unsigned int *)()
_____________________________________________________________________________________________
*** CID 661079: Error handling issues (CHECKED_RETURN)
/pack_rep.cpp: 114 in sbbs_t::pack_rep(unsigned int, unsigned int *)()
108 fexistcase(str);
109 if ((hdrs = fopen(str, "a")) == NULL)
110 errormsg(WHERE, ERR_CREATE, str, 0);
111 }
112 if (!(cfg.qhub[hubnum]->misc & QHUB_NOVOTING)) {
113 SAFEPRINTF(str, "%sVOTING.DAT", cfg.temp_dir);
CID 661079: Error handling issues (CHECKED_RETURN)
Calling "fexistcase" without checking return value (as is done elsewhere 126 out of 136 times).
114 fexistcase(str);
115 if ((voting = fopen(str, "a")) == NULL)
116 errormsg(WHERE, ERR_CREATE, str, 0);
117 }
118 /*********************/
119 /* Pack new messages */
** CID 661078: (Y2K38_SAFETY)
/pack_qwk.cpp: 628 in sbbs_t::pack_qwk(char *, unsigned int *, bool, qwkjob_result *)()
/pack_qwk.cpp: 146 in sbbs_t::pack_qwk(char *, unsigned int *, bool, qwkjob_result *)()
/pack_qwk.cpp: 623 in sbbs_t::pack_qwk(char *, unsigned int *, bool, qwkjob_result *)()
_____________________________________________________________________________________________
*** CID 661078: (Y2K38_SAFETY)
/pack_qwk.cpp: 628 in sbbs_t::pack_qwk(char *, unsigned int *, bool, qwkjob_result *)()
622 , tmp
623 , (uint)elapsed
624 , (uint64_t)((*msgcnt) + mailmsgs) / elapsed);
625 lprintf(LOG_INFO, "packed %u messages (%s bytes) in %u seconds (%u msgs/sec)"
626 , (*msgcnt) + mailmsgs
627 , tmp
CID 661078: (Y2K38_SAFETY)
A "time_t" value is stored in an integer with too few bits to accommodate it. The expression "elapsed" is cast to "uint".
628 , (uint)elapsed
629 , (uint)(((*msgcnt) + mailmsgs) / elapsed)); 630 }
631
632 BOOL voting_data = FALSE;
633 if (!fclose_checked(qwk)) {
/pack_qwk.cpp: 146 in sbbs_t::pack_qwk(char *, unsigned int *, bool, qwkjob_result *)()
140 return false;
141 }
142
143 now = time(NULL);
144 if (localtime_r(&now, &tm) == NULL) {
145 fclose(stream);
CID 661078: (Y2K38_SAFETY)
A "time_t" value is stored in an integer with too few bits to accommodate it. The expression "this->now" is cast to "uint".
146 errormsg(WHERE, ERR_CHK, "time", (uint)now); 147 return false;
148 }
149
150 fprintf(stream, "%s\r\n%s\r\n%s\r\n%s, Sysop\r\n0000,%s\r\n"
151 "%02u-%02u-%u,%02u:%02u:%02u\r\n" /pack_qwk.cpp: 623 in sbbs_t::pack_qwk(char *, unsigned int *, bool, qwkjob_result *)()
617 byte_estimate_to_str(ftell(qwk), tmp, sizeof(tmp), 1024, 1);
618 if (online == ON_REMOTE)
619 bprintf("\r\n\r\n\1n\1hPacked %u messages (%s bytes) in %u seconds "
620 "(%" PRIu64 " messages/second)."
621 , (*msgcnt) + mailmsgs
622 , tmp
CID 661078: (Y2K38_SAFETY)
A "time_t" value is stored in an integer with too few bits to accommodate it. The expression "elapsed" is cast to "uint".
623 , (uint)elapsed
624 , (uint64_t)((*msgcnt) + mailmsgs) / elapsed);
625 lprintf(LOG_INFO, "packed %u messages (%s bytes) in %u seconds (%u msgs/sec)"
626 , (*msgcnt) + mailmsgs
627 , tmp
628 , (uint)elapsed
** CID 661077: Security best practices violations (TOCTOU)
/nopen.c: 217 in fmutex_close()
_____________________________________________________________________________________________
*** CID 661077: Security best practices violations (TOCTOU)
/nopen.c: 217 in fmutex_close()
211 #if !defined _WIN32 // should only be necessary (and possible) on *nix 212 // Remove before close, and only the file we opened: once our lock aged out and
213 // was taken over, the file by this name is the new holder's 214 if (fstat(fm->fd, &fd_st) != 0) {
215 error = errno;
216 result = false;
CID 661077: Security best practices violations (TOCTOU)
Calling function "stat" to perform check on "fm->name".
217 } else if (stat(fm->name, &name_st) != 0) {
218 if (errno != ENOENT) {
219 error = errno;
220 result = false;
221 }
222 } else if (fd_st.st_dev == name_st.st_dev && fd_st.st_ino == name_st.st_ino) {
** CID 661076: (CHECKED_RETURN)
/qwkjob.cpp: 412 in qwkjob_pack_locked(sbbs_t *, const qwkjob_host *, unsigned int, unsigned int *, char *, unsigned long)()
/qwkjob.cpp: 397 in qwkjob_pack_locked(sbbs_t *, const qwkjob_host *, unsigned int, unsigned int *, char *, unsigned long)()
_____________________________________________________________________________________________
*** CID 661076: (CHECKED_RETURN)
/qwkjob.cpp: 412 in qwkjob_pack_locked(sbbs_t *, const qwkjob_host *, unsigned int, unsigned int *, char *, unsigned long)()
406 if (!qwkjob_replace_file(tmppath, qwkpath)) {
407 #ifdef _WIN32
408 sbbs->lprintf(LOG_ERR, "!ERROR (WinError %u) renaming %s to %s", (uint)GetLastError(), tmppath, qwkpath);
409 #else
410 sbbs->lprintf(LOG_ERR, "!ERROR %d (%s) renaming %s to %s", errno, strerror(errno), tmppath, qwkpath);
411 #endif
CID 661076: (CHECKED_RETURN)
Calling "remove(tmppath)" without checking return value. This library function may fail and return an error code.
412 remove(tmppath);
413 return QWKJOB_FAILED;
414 }
415 sbbs->lprintf(LOG_INFO, "Packing completed: %s", qwkpath);
416 sbbs->qwk_success(count, 0, /* prepack: */ 1);
417 sbbs->putmsgptrs();
/qwkjob.cpp: 397 in qwkjob_pack_locked(sbbs_t *, const qwkjob_host *, unsigned int, unsigned int *, char *, unsigned long)()
391 if (qwkjob_terminated(host))
392 return QWKJOB_FAILED;
393 sbbs->lprintf(LOG_INFO, "Packing QWK Message Packet");
394 SAFEPRINTF4(tmppath, "%sfile/%04u.%s.%d.qwk.tmp", sbbs->cfg.data_dir, usernum, qwkjob_local_host_name(), (int)getpid());
395 SAFEPRINTF2(qwkpath, "%sfile/%04u.qwk", sbbs->cfg.data_dir, usernum);
396 if (!sbbs->pack_qwk(tmppath, &count, /* prepack: */ true, &reason)) {
CID 661076: (CHECKED_RETURN)
Calling "remove(tmppath)" without checking return value. This library function may fail and return an error code.
397 remove(tmppath);
398 if (reason == QWKJOB_EMPTY)
399 sbbs->lputs(LOG_INFO, "No packet created (no new messages)");
400 return reason;
401 }
402 if (qwkjob_terminated(host)) {
** CID 661075: Incorrect expression (EVALUATION_ORDER)
/pack_qwk.cpp: 798 in sbbs_t::pack_qwk(char *, unsigned int *, bool, qwkjob_result *)()
_____________________________________________________________________________________________
*** CID 661075: Incorrect expression (EVALUATION_ORDER)
/pack_qwk.cpp: 798 in sbbs_t::pack_qwk(char *, unsigned int *, bool, qwkjob_result *)()
792 lprintf(LOG_ERR, "libarchive error (%s) creating %s", error, packet);
793 else
794 lprintf(LOG_INFO, "libarchive created %s from %d files", packet, file_count);
795 }
796 if (flength(packet) < 1) {
797 remove(packet);
CID 661075: Incorrect expression (EVALUATION_ORDER)
In argument #1 of "this->cmdstr(this->temp_cmd(ex), packet, path, NULL, ex)", a call is made to "this->temp_cmd(ex)". In argument #1 of this function, the object "ex" is modified. This object is also used in "ex", the argument #5 of the outer function call. The order in which these arguments are evaluated is not specified, and will vary between platforms.
798 cmdstr(temp_cmd(ex), packet, path, NULL, ex);
799 if ((i = external(cmdstr_output, ex | EX_WILDCARD)) != 0)
800 errormsg(WHERE, ERR_EXEC, cmdstr_output, i); 801 if (flength(packet) < 1) {
802 bputs(text[QWKCompressionFailed]);
803 return false;
________________________________________________________________________________________________________
To view the defects in Coverity Scan visit,
https://scan.coverity.com/projects/synchronet?tab=overview
----==_mimepart_6adf4c5fd5c7a_121aef2b1c6f8d19ac1572d
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>New Defects Reported - Synchronet</title>
<style>
body { font-family: Arial, sans-serif; color: #222; line-height: 1.6; }
.button {
display: inline-block;
padding: 10px 20px;
margin: 20px 0;
font-size: 16px;
color: #fff !important;
background-color: #0056b3;
text-decoration: none;
border-radius: 5px;
}
pre {
background: #f8f9fa;
padding: 10px;
border-radius: 5px;
font-size: 14px;
overflow-x: auto;
}
</style>
</head>
<body>
<p>Hi,</p>
<p>
Please find the latest report on new defect(s) introduced to <strong>Synchronet</strong>
found with Coverity Scan.
</p>
<ul>
<li><strong>New Defects Found:</strong> 5</li>
<li>
3 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan.
</li>
<li><strong>Defects Shown:</strong> Showing 5 of 5 defect(s)</li>
</ul>
<h3>Defect Details</h3>
<pre>
** CID 661079: Error handling issues (CHECKED_RETURN)
/pack_rep.cpp: 114 in sbbs_t::pack_rep(unsigned int, unsigned int *)()
_____________________________________________________________________________________________
*** CID 661079: Error handling issues (CHECKED_RETURN)
/pack_rep.cpp: 114 in sbbs_t::pack_rep(unsigned int, unsigned int *)()
108 fexistcase(str);
109 if ((hdrs = fopen(str, "a")) == NULL)
110 errormsg(WHERE, ERR_CREATE, str, 0);
111 }
112 if (!(cfg.qhub[hubnum]->misc & QHUB_NOVOTING)) {
113 SAFEPRINTF(str, "%sVOTING.DAT", cfg.temp_dir);
>>> CID 661079: Error handling issues (CHECKED_RETURN) >>> Calling "fexistcase" without checking return value (as is done elsewhere 126 out of 136 times).
114 fexistcase(str);
115 if ((voting = fopen(str, "a")) == NULL)
116 errormsg(WHERE, ERR_CREATE, str, 0);
117 }
118 /*********************/
119 /* Pack new messages */
** CID 661078: (Y2K38_SAFETY)
/pack_qwk.cpp: 628 in sbbs_t::pack_qwk(char *, unsigned int *, bool, qwkjob_result *)()
/pack_qwk.cpp: 146 in sbbs_t::pack_qwk(char *, unsigned int *, bool, qwkjob_result *)()
/pack_qwk.cpp: 623 in sbbs_t::pack_qwk(char *, unsigned int *, bool, qwkjob_result *)()
_____________________________________________________________________________________________
*** CID 661078: (Y2K38_SAFETY)
/pack_qwk.cpp: 628 in sbbs_t::pack_qwk(char *, unsigned int *, bool, qwkjob_result *)()
622 , tmp
623 , (uint)elapsed
624 , (uint64_t)((*msgcnt) + mailmsgs) / elapsed);
625 lprintf(LOG_INFO, "packed %u messages (%s bytes) in %u seconds (%u msgs/sec)"
626 , (*msgcnt) + mailmsgs
627 , tmp
>>> CID 661078: (Y2K38_SAFETY)
>>> A "time_t" value is stored in an integer with too few bits to accommodate it. The expression "elapsed" is cast to "uint".
628 , (uint)elapsed
629 , (uint)(((*msgcnt) + mailmsgs) / elapsed)); 630 }
631
632 BOOL voting_data = FALSE;
633 if (!fclose_checked(qwk)) {
/pack_qwk.cpp: 146 in sbbs_t::pack_qwk(char *, unsigned int *, bool, qwkjob_result *)()
140 return false;
141 }
142
143 now = time(NULL);
144 if (localtime_r(&now, &tm) == NULL) {
145 fclose(stream);
>>> CID 661078: (Y2K38_SAFETY)
>>> A "time_t" value is stored in an integer with too few bits to accommodate it. The expression "this->now" is cast to "uint".
146 errormsg(WHERE, ERR_CHK, "time", (uint)now);
147 return false;
148 }
149
150 fprintf(stream, "%s\r\n%s\r\n%s\r\n%s, Sysop\r\n0000,%s\r\n"
151 "%02u-%02u-%u,%02u:%02u:%02u\r\n" /pack_qwk.cpp: 623 in sbbs_t::pack_qwk(char *, unsigned int *, bool, qwkjob_result *)()
617 byte_estimate_to_str(ftell(qwk), tmp, sizeof(tmp), 1024, 1);
618 if (online == ON_REMOTE)
619 bprintf("\r\n\r\n\1n\1hPacked %u messages (%s bytes) in %u seconds "
620 "(%" PRIu64 " messages/second)."
621 , (*msgcnt) + mailmsgs
622 , tmp
>>> CID 661078: (Y2K38_SAFETY)
>>> A "time_t" value is stored in an integer with too few bits to accommodate it. The expression "elapsed" is cast to "uint".
623 , (uint)elapsed
624 , (uint64_t)((*msgcnt) + mailmsgs) / elapsed);
625 lprintf(LOG_INFO, "packed %u messages (%s bytes) in %u seconds (%u msgs/sec)"
626 , (*msgcnt) + mailmsgs
627 , tmp
628 , (uint)elapsed
** CID 661077: Security best practices violations (TOCTOU)
/nopen.c: 217 in fmutex_close()
_____________________________________________________________________________________________
*** CID 661077: Security best practices violations (TOCTOU)
/nopen.c: 217 in fmutex_close()
211 #if !defined _WIN32 // should only be necessary (and possible) on *nix 212 // Remove before close, and only the file we opened: once our lock aged out and
213 // was taken over, the file by this name is the new holder's
214 if (fstat(fm->fd, &fd_st) != 0) {
215 error = errno;
216 result = false;
>>> CID 661077: Security best practices violations (TOCTOU)
>>> Calling function "stat" to perform check on "fm->name".
217 } else if (stat(fm->name, &name_st) != 0) {
218 if (errno != ENOENT) {
219 error = errno;
220 result = false;
221 }
222 } else if (fd_st.st_dev == name_st.st_dev && fd_st.st_ino == name_st.st_ino) {
** CID 661076: (CHECKED_RETURN)
/qwkjob.cpp: 412 in qwkjob_pack_locked(sbbs_t *, const qwkjob_host *, unsigned int, unsigned int *, char *, unsigned long)()
/qwkjob.cpp: 397 in qwkjob_pack_locked(sbbs_t *, const qwkjob_host *, unsigned int, unsigned int *, char *, unsigned long)()
_____________________________________________________________________________________________
*** CID 661076: (CHECKED_RETURN)
/qwkjob.cpp: 412 in qwkjob_pack_locked(sbbs_t *, const qwkjob_host *, unsigned int, unsigned int *, char *, unsigned long)()
406 if (!qwkjob_replace_file(tmppath, qwkpath)) {
407 #ifdef _WIN32
408 sbbs->lprintf(LOG_ERR, "!ERROR (WinError %u) renaming %s to %s", (uint)GetLastError(), tmppath, qwkpath);
409 #else
410 sbbs->lprintf(LOG_ERR, "!ERROR %d (%s) renaming %s to %s", errno, strerror(errno), tmppath, qwkpath);
411 #endif
>>> CID 661076: (CHECKED_RETURN)
>>> Calling "remove(tmppath)" without checking return value. This library function may fail and return an error code.
412 remove(tmppath);
413 return QWKJOB_FAILED;
414 }
415 sbbs->lprintf(LOG_INFO, "Packing completed: %s", qwkpath);
416 sbbs->qwk_success(count, 0, /* prepack: */ 1);
417 sbbs->putmsgptrs();
/qwkjob.cpp: 397 in qwkjob_pack_locked(sbbs_t *, const qwkjob_host *, unsigned int, unsigned int *, char *, unsigned long)()
391 if (qwkjob_terminated(host))
392 return QWKJOB_FAILED;
393 sbbs->lprintf(LOG_INFO, "Packing QWK Message Packet");
394 SAFEPRINTF4(tmppath, "%sfile/%04u.%s.%d.qwk.tmp", sbbs->cfg.data_dir, usernum, qwkjob_local_host_name(), (int)getpid());
395 SAFEPRINTF2(qwkpath, "%sfile/%04u.qwk", sbbs->cfg.data_dir, usernum);
396 if (!sbbs->pack_qwk(tmppath, &count, /* prepack: */ true, &reason)) {
>>> CID 661076: (CHECKED_RETURN)
>>> Calling "remove(tmppath)" without checking return value. This library function may fail and return an error code.
397 remove(tmppath);
398 if (reason == QWKJOB_EMPTY)
399 sbbs->lputs(LOG_INFO, "No packet created (no new messages)");
400 return reason;
401 }
402 if (qwkjob_terminated(host)) {
** CID 661075: Incorrect expression (EVALUATION_ORDER)
/pack_qwk.cpp: 798 in sbbs_t::pack_qwk(char *, unsigned int *, bool, qwkjob_result *)()
_____________________________________________________________________________________________
*** CID 661075: Incorrect expression (EVALUATION_ORDER)
/pack_qwk.cpp: 798 in sbbs_t::pack_qwk(char *, unsigned int *, bool, qwkjob_result *)()
792 lprintf(LOG_ERR, "libarchive error (%s) creating %s", error, packet);
793 else
794 lprintf(LOG_INFO, "libarchive created %s from %d files", packet, file_count);
795 }
796 if (flength(packet) < 1) {
797 remove(packet);
>>> CID 661075: Incorrect expression (EVALUATION_ORDER) >>> In argument #1 of "this->cmdstr(this->temp_cmd(ex), packet, path, NULL, ex)", a call is made to "this->temp_cmd(ex)". In argument #1 of this function, the object "ex" is modified. This object is also used in "ex", the argument #5 of the outer function call. The order in which these arguments are evaluated is not specified, and will vary between platforms.
798 cmdstr(temp_cmd(ex), packet, path, NULL, ex);
799 if ((i = external(cmdstr_output, ex | EX_WILDCARD)) != 0)
800 errormsg(WHERE, ERR_EXEC, cmdstr_output, i); 801 if (flength(packet) < 1) {
802 bputs(text[QWKCompressionFailed]);
803 return false;
</pre>
<p>
<a href="
https://scan.coverity.com/projects/synchronet?tab=overview" class="button">View Defects in Coverity Scan</a>
</p>
<p>Best regards,</p>
<p>The Coverity Scan Admin Team</p>
<img class="logo" width="140" src="
https://scan.coverity.com/assets/BlackDuckLogo-6697adc63e07340464201a2ad534d3d3e44f95d36edda20b140440d34f05372f.svg" />
</body>
</html>
----==_mimepart_6adf4c5fd5c7a_121aef2b1c6f8d19ac1572d--
--- SBBSecho 3.38-Linux
* Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)