diff options
author | Ken Raeburn <raeburn@mit.edu> | 2006-03-31 01:34:38 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@mit.edu> | 2006-03-31 01:34:38 +0000 |
commit | aed2ffc61872ca26950cafdcade26a35c1137699 (patch) | |
tree | 6da89c323b00eacef0ccf0c59112859f7f6b6112 | |
parent | a27d828c8798244dad5b82f5111e2ce5e450c40d (diff) | |
download | krb5-aed2ffc61872ca26950cafdcade26a35c1137699.tar.gz krb5-aed2ffc61872ca26950cafdcade26a35c1137699.tar.xz krb5-aed2ffc61872ca26950cafdcade26a35c1137699.zip |
* util_token.c: Include limits.h.
(der_length_size, der_write_length): Test INT_MAX instead of SIZEOF_INT.
(der_read_length): Test sizeof(int) instead of SIZEOF_INT.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17812 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r-- | src/lib/gssapi/generic/ChangeLog | 7 | ||||
-rw-r--r-- | src/lib/gssapi/generic/util_token.c | 7 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/lib/gssapi/generic/ChangeLog b/src/lib/gssapi/generic/ChangeLog index d4a3a66f98..803ae6c527 100644 --- a/src/lib/gssapi/generic/ChangeLog +++ b/src/lib/gssapi/generic/ChangeLog @@ -1,3 +1,10 @@ +2006-03-30 Ken Raeburn <raeburn@mit.edu> + + * util_token.c: Include limits.h. + (der_length_size, der_write_length): Test INT_MAX instead of + SIZEOF_INT. + (der_read_length): Test sizeof(int) instead of SIZEOF_INT. + 2006-03-27 Ken Raeburn <raeburn@mit.edu> * Makefile.in (include_xom): Define as "rem" instead of empty on diff --git a/src/lib/gssapi/generic/util_token.c b/src/lib/gssapi/generic/util_token.c index 97a788c09e..6277e942a2 100644 --- a/src/lib/gssapi/generic/util_token.c +++ b/src/lib/gssapi/generic/util_token.c @@ -24,6 +24,7 @@ #ifdef HAVE_MEMORY_H #include <memory.h> #endif +#include <limits.h> /* * $Id$ @@ -65,7 +66,7 @@ static unsigned int der_length_size(length) return(1); else if (length < (1<<8)) return(2); -#if (SIZEOF_INT == 2) +#if INT_MAX == 0x7fff else return(3); #else @@ -86,7 +87,7 @@ static void der_write_length(buf, length) *(*buf)++ = (unsigned char) length; } else { *(*buf)++ = (unsigned char) (der_length_size(length)+127); -#if (SIZEOF_INT > 2) +#if INT_MAX > 0x7fff if (length >= (1<<24)) *(*buf)++ = (unsigned char) (length>>24); if (length >= (1<<16)) @@ -115,7 +116,7 @@ static int der_read_length(buf, bufsize) if (sf & 0x80) { if ((sf &= 0x7f) > ((*bufsize)-1)) return(-1); - if (sf > SIZEOF_INT) + if (sf > sizeof(int)) return (-1); ret = 0; for (; sf; sf--) { |