summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-08-22 12:33:35 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2020-08-22 12:34:24 +0200
commit969a432fd8b34a0ec4e48e903370f0659aef6b04 (patch)
treee157bf5a661325f0ea562af63e66240052903341
parent47c787ff5b80764b59dead181633ec45dbd2d70c (diff)
parent81fffa86b230c73a5ad4fe18108e6dc90d67d5a6 (diff)
downloadphp-git-969a432fd8b34a0ec4e48e903370f0659aef6b04.tar.gz
Merge branch 'PHP-7.4' into master
* PHP-7.4: Fix #80007: Potential type confusion in unixtojd() parameter parsing
-rw-r--r--NEWS4
-rw-r--r--ext/calendar/cal_unix.c11
2 files changed, 11 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 6666861170..65395d8f2b 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.0.0beta3
+- Calendar:
+ . Fixed bug #80007 (Potential type confusion in unixtojd() parameter parsing).
+ (Andy Postnikov)
+
- DOM:
. Fixed bug #79968 (DOMChildNode API crash on unattached nodes). (Benjamin)
diff --git a/ext/calendar/cal_unix.c b/ext/calendar/cal_unix.c
index 6b5fbf7f79..55d67823ff 100644
--- a/ext/calendar/cal_unix.c
+++ b/ext/calendar/cal_unix.c
@@ -25,16 +25,19 @@
PHP_FUNCTION(unixtojd)
{
time_t ts;
- zend_bool ts_is_null = 1;
+ zend_long tl = 0;
+ zend_bool tl_is_null = 1;
struct tm *ta, tmbuf;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &ts, &ts_is_null) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &tl, &tl_is_null) == FAILURE) {
RETURN_THROWS();
}
- if (ts_is_null) {
+ if (tl_is_null) {
ts = time(NULL);
- } else if (ts < 0) {
+ } else if (tl >= 0) {
+ ts = (time_t) tl;
+ } else {
zend_argument_value_error(1, "must be greater than or equal to 0");
RETURN_THROWS();
}