[Git][NTPsec/ntpsec][master] 2 commits: Address Coverity CID 161765: Integer handling issues (SIGN_EXTENSION).
Eric S. Raymond
gitlab at mg.gitlab.com
Thu May 11 18:18:35 UTC 2017
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
0ecdf682 by Eric S. Raymond at 2017-05-11T14:10:41-04:00
Address Coverity CID 161765: Integer handling issues (SIGN_EXTENSION).
- - - - -
42f1ca69 by Eric S. Raymond at 2017-05-11T14:18:20-04:00
Fix resource leaks in directory-walking code.
Addresses Coverity CIDs 161765 and 161764.
- - - - -
2 changed files:
- libparse/binio.c
- ntpd/ntp_scanner.c
Changes:
=====================================
libparse/binio.c
=====================================
--- a/libparse/binio.c
+++ b/libparse/binio.c
@@ -37,14 +37,14 @@ get_lsb_ulong(
unsigned char **bufpp
)
{
- long retval;
+ unsigned long retval;
retval = *((*bufpp)++);
retval |= *((*bufpp)++) << 8;
retval |= *((*bufpp)++) << 16;
retval |= *((*bufpp)++) << 24;
- return (unsigned long)retval;
+ return retval;
}
void
=====================================
ntpd/ntp_scanner.c
=====================================
--- a/ntpd/ntp_scanner.c
+++ b/ntpd/ntp_scanner.c
@@ -408,10 +408,11 @@ bool lex_push_file(
/* directory scanning */
DIR *dfd;
struct dirent *dp;
- char **baselist = (char **)malloc(sizeof(char *));
+ char **baselist;
int basecount = 0;
if ((dfd = opendir(fullpath)) == NULL)
return false;
+ baselist = (char **)malloc(sizeof(char *));
while ((dp = readdir(dfd)) != NULL)
{
if (!CONF_ENABLE(dp->d_name))
@@ -420,6 +421,7 @@ bool lex_push_file(
baselist = realloc(baselist,
(size_t)(basecount+1) * sizeof(char *));
}
+ closedir(dfd);
qsort(baselist, (size_t)basecount, sizeof(char *),
rcmpstring);
for (int i = 0; i < basecount; i++) {
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/ead81255a74141ce7df7d5843e198675deb7d8da...42f1ca69fd8c4d30b3eddc12cfc4ce929a72cfb1
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/ead81255a74141ce7df7d5843e198675deb7d8da...42f1ca69fd8c4d30b3eddc12cfc4ce929a72cfb1
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170511/d6b0b48b/attachment.html>
More information about the vc
mailing list