Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
BIND
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
637
Issues
637
List
Boards
Labels
Service Desk
Milestones
Merge Requests
104
Merge Requests
104
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
BIND
Commits
269c0717
Commit
269c0717
authored
Mar 08, 2012
by
Mark Andrews
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
3295. [bug] Adjust isc_time_secondsastimet range check to be more
portable. [RT # 26542]
parent
962bf88e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
21 deletions
+6
-21
CHANGES
CHANGES
+3
-0
lib/isc/unix/time.c
lib/isc/unix/time.c
+3
-21
No files found.
CHANGES
View file @
269c0717
3295. [bug] Adjust isc_time_secondsastimet range check to be more
portable. [RT # 26542]
3294. [bug] isccc/cc.c:table_fromwire failed to free alist on
error. [RT #28265]
...
...
lib/isc/unix/time.c
View file @
269c0717
...
...
@@ -334,7 +334,6 @@ isc_time_seconds(const isc_time_t *t) {
isc_result_t
isc_time_secondsastimet
(
const
isc_time_t
*
t
,
time_t
*
secondsp
)
{
isc_uint64_t
i
;
time_t
seconds
;
REQUIRE
(
t
!=
NULL
);
...
...
@@ -354,33 +353,16 @@ isc_time_secondsastimet(const isc_time_t *t, time_t *secondsp) {
* pretty much only true if time_t is a signed integer of the same
* size as the return value of isc_time_seconds.
*
* The use of the 64 bit integer ``i'' takes advantage of C's
* conversion rules to either zero fill or sign extend the widened
* type.
*
* Solaris 5.6 gives this warning about the left shift:
* warning: integer overflow detected: op "<<"
* if the U(nsigned) qualifier is not on the 1.
* If the paradox in the if clause below is true, t->seconds is out
* of range for time_t.
*/
seconds
=
(
time_t
)
t
->
seconds
;
INSIST
(
sizeof
(
unsigned
int
)
==
sizeof
(
isc_uint32_t
));
INSIST
(
sizeof
(
time_t
)
>=
sizeof
(
isc_uint32_t
));
if
(
sizeof
(
time_t
)
==
sizeof
(
isc_uint32_t
)
&&
/* Same size. */
(
time_t
)
0
.
5
!=
0
.
5
&&
/* Not a floating point type. */
(
i
=
(
time_t
)
-
1
)
!=
4294967295u
&&
/* Is signed. */
(
seconds
&
(
1U
<<
(
sizeof
(
time_t
)
*
CHAR_BIT
-
1
)))
!=
0U
)
{
/* Negative. */
/*
* This UNUSED() is here to shut up the IRIX compiler:
* variable "i" was set but never used
* when the value of i *was* used in the third test.
* (Let's hope the compiler got the actual test right.)
*/
UNUSED
(
i
);
if
(
t
->
seconds
>
(
~
0U
>>
1
)
&&
seconds
<=
(
time_t
)(
~
0U
>>
1
))
return
(
ISC_R_RANGE
);
}
*
secondsp
=
seconds
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment