Skip to content

Commit

Permalink
bump version to 2.4.4
Browse files Browse the repository at this point in the history
 * remove checks for negative unsigned ints, fixes #2
 * harden error logging functions, fixes #3
  • Loading branch information
tlby committed Jan 31, 2019
1 parent ccb757d commit 29a9c23
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
netmask (2.4.4) unstable; urgency=low

* harden error logging functions

-- Robert Stone <[email protected]> Thu, 31 Jan 2019 09:26:52 -0800

netmask (2.4.3) unstable; urgency=low

* repair broken ":+" style range additions for #802884
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT([netmask], [2.4.3])
AC_INIT([netmask], [2.4.4])
AC_CONFIG_SRCDIR([main.c])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign])
Expand Down
8 changes: 4 additions & 4 deletions errors.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int status(const char *fmt, ...) {

if(!show_status) return(0);
va_start(args, fmt);
vsprintf(buf, fmt, args);
vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
return(message(LOG_DEBUG, buf));
}
Expand All @@ -76,7 +76,7 @@ int warn(const char *fmt, ...) {
va_list args;

va_start(args, fmt);
vsprintf(buf, fmt, args);
vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
return(message(LOG_WARNING, buf));
}
Expand All @@ -86,7 +86,7 @@ int panic(const char *fmt, ...) {
va_list args;

va_start(args, fmt);
vsprintf(buf, fmt, args);
vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
message(LOG_ERR, buf);
exit(1);
Expand All @@ -97,7 +97,7 @@ int message(int priority, const char *msg) {

/* only handle errno if this is not an informational message */
if(errno && priority < 5) {
sprintf(buf, "%s: %s", msg, strerror(errno));
snprintf(buf, sizeof(buf), "%s: %s", msg, strerror(errno));
errno = 0;
} else strcpy(buf, msg);
if(use_syslog) syslog(priority, "%s", buf);
Expand Down
4 changes: 2 additions & 2 deletions netmask.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,10 @@ static inline int parse_mask(NM self, const char *str, int flags) {
if(*p == '\0') {
/* read it as a CIDR value */
if(is_v4(self)) {
if(v < 0 || v > 32) return 0;
if(v > 32) return 0;
v += 96;
} else {
if(v < 0 || v > 128) return 0;
if(v > 128) return 0;
}
self->mask = u128_cidr(v);
} else if(inet_pton(AF_INET6, str, &s6)) {
Expand Down

0 comments on commit 29a9c23

Please sign in to comment.