diff options
-rw-r--r-- | kerberosIV/krb/asprintf.c | 13 | ||||
-rw-r--r-- | kerberosIV/krb/getaddrs.c | 10 | ||||
-rw-r--r-- | kerberosIV/krb/recvauth.c | 10 |
3 files changed, 29 insertions, 4 deletions
diff --git a/kerberosIV/krb/asprintf.c b/kerberosIV/krb/asprintf.c index 7a08bd181cb..30605e5e9e3 100644 --- a/kerberosIV/krb/asprintf.c +++ b/kerberosIV/krb/asprintf.c @@ -45,6 +45,15 @@ #include <string.h> #include <ctype.h> +#ifndef MAX +#define MAX(a,b) (((a)>(b))?(a):(b)) +#endif /* MAX */ + +#ifndef MIN +#define MIN(a,b) (((a)<(b))?(a):(b)) +#endif /* MIN */ + + enum format_flags { minus_flag = 1, plus_flag = 2, @@ -97,7 +106,7 @@ as_reserve (struct state *state, size_t n) return 1; if (state->max_sz) - state->sz = min(state->max_sz, state->sz*2); + state->sz = MIN(state->max_sz, state->sz*2); else state->sz *= 2; tmp = realloc (state->str, state->sz); @@ -521,7 +530,7 @@ vasnprintf (char **ret, size_t max_sz, const char *format, va_list args) state.max_sz = max_sz; if (max_sz) - state.sz = min(1, max_sz); + state.sz = MIN(1, max_sz); else state.sz = 1; state.str = malloc(state.sz); diff --git a/kerberosIV/krb/getaddrs.c b/kerberosIV/krb/getaddrs.c index 9a45422b090..d58e2f67af5 100644 --- a/kerberosIV/krb/getaddrs.c +++ b/kerberosIV/krb/getaddrs.c @@ -44,6 +44,14 @@ #include <net/if.h> #include <sys/sockio.h> +#ifndef MAX +#define MAX(a,b) (((a)>(b))?(a):(b)) +#endif /* MAX */ + +#ifndef MIN +#define MIN(a,b) (((a)<(b))?(a):(b)) +#endif /* MIN */ + /* * Return number and list of all local adresses. */ @@ -78,7 +86,7 @@ k_get_all_addrs (struct in_addr **l) for (p = ifconf.ifc_buf; p < ifconf.ifc_buf + ifconf.ifc_len;) { struct ifreq *ifr = (struct ifreq *)p; size_t sz = sizeof(*ifr); - sz = max(sz, sizeof(ifr->ifr_name) + ifr->ifr_addr.sa_len); + sz = MAX(sz, sizeof(ifr->ifr_name) + ifr->ifr_addr.sa_len); if(strncmp(ifreq.ifr_name, ifr->ifr_name, sizeof(ifr->ifr_name))) { if(ioctl(fd, SIOCGIFFLAGS, ifr) < 0) { diff --git a/kerberosIV/krb/recvauth.c b/kerberosIV/krb/recvauth.c index f1286ebe3f6..70e3df67f79 100644 --- a/kerberosIV/krb/recvauth.c +++ b/kerberosIV/krb/recvauth.c @@ -23,6 +23,14 @@ or implied warranty. #include "krb_locl.h" +#ifndef MAX +#define MAX(a,b) (((a)>(b))?(a):(b)) +#endif /* MAX */ + +#ifndef MIN +#define MIN(a,b) (((a)<(b))?(a):(b)) +#endif /* MIN */ + /* * krb_recvauth() reads (and optionally responds to) a message sent * using krb_sendauth(). The "options" argument is a bit-field of @@ -115,7 +123,7 @@ krb_recvauth(int32_t options, /* bit-pattern of options */ char krb_vers[KRB_SENDAUTH_VLEN + 1]; /* + 1 for the null terminator */ int rem; int32_t priv_len; - u_char tmp_buf[MAX_KTXT_LEN+max(KRB_SENDAUTH_VLEN+1,21)]; + u_char tmp_buf[MAX_KTXT_LEN+MAX(KRB_SENDAUTH_VLEN+1,21)]; if (!(options & KOPT_IGNORE_PROTOCOL)) { /* read the protocol version number */ |