mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-02 23:55:27 +00:00
made operand to left shift in ISC_OFFSET_MAXIMUM unsigned to avoid
integer overflow.
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: offset.h,v 1.4 2000/05/25 03:34:34 tale Exp $ */
|
/* $Id: offset.h,v 1.5 2000/05/25 16:44:25 tale Exp $ */
|
||||||
|
|
||||||
#ifndef ISC_OFFSET_H
|
#ifndef ISC_OFFSET_H
|
||||||
#define ISC_OFFSET_H 1
|
#define ISC_OFFSET_H 1
|
||||||
@@ -31,7 +31,9 @@ typedef off_t isc_offset_t;
|
|||||||
/*
|
/*
|
||||||
* POSIX says "Additionally, blkcnt_t and off_t are extended signed integral
|
* POSIX says "Additionally, blkcnt_t and off_t are extended signed integral
|
||||||
* types", so the maximum value is all 1s except for the high bit.
|
* types", so the maximum value is all 1s except for the high bit.
|
||||||
|
* 1 is sized as an unsigned long long to keep the Solaris 5.6 compiler
|
||||||
|
* from complaining about integer overflow from the left shift.
|
||||||
*/
|
*/
|
||||||
#define ISC_OFFSET_MAXIMUM (~((off_t)1 << (sizeof(off_t) * CHAR_BIT - 1)))
|
#define ISC_OFFSET_MAXIMUM ((off_t)~(1ULL << (sizeof(off_t) * CHAR_BIT - 1)))
|
||||||
|
|
||||||
#endif /* ISC_OFFSET_H */
|
#endif /* ISC_OFFSET_H */
|
||||||
|
Reference in New Issue
Block a user