aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-10-29 22:53:00 +0100
committerLars Ingebrigtsen2019-10-29 22:53:00 +0100
commitd3517de4b472ede7abaf3a552c5064be979e6eff (patch)
tree85981730af642a40e7bb9213eedbf1d53e8bd1f9
parent6f7e99fb1896b1414187d98b4b1459d04ac94823 (diff)
downloademacs-d3517de4b472ede7abaf3a552c5064be979e6eff.tar.gz
emacs-d3517de4b472ede7abaf3a552c5064be979e6eff.zip
Make url-cookie.el be more resistant against bogus data
* lisp/url/url-cookie.el (url-cookie-handle-set-cookie): Don't bug out on large max-age values (bug#37974).
-rw-r--r--lisp/url/url-cookie.el7
1 files changed, 4 insertions, 3 deletions
diff --git a/lisp/url/url-cookie.el b/lisp/url/url-cookie.el
index 31fc3e72664..740a43fa16f 100644
--- a/lisp/url/url-cookie.el
+++ b/lisp/url/url-cookie.el
@@ -304,9 +304,10 @@ i.e. 1970-1-1) are loaded as expiring one year from now instead."
304 (url-filename url-current-object)))) 304 (url-filename url-current-object))))
305 (expires nil)) 305 (expires nil))
306 (if (and max-age (string-match "\\`-?[0-9]+\\'" max-age)) 306 (if (and max-age (string-match "\\`-?[0-9]+\\'" max-age))
307 (setq expires (format-time-string "%a %b %d %H:%M:%S %Y GMT" 307 (setq expires (ignore-errors
308 (time-add nil (read max-age)) 308 (format-time-string "%a %b %d %H:%M:%S %Y GMT"
309 t)) 309 (time-add nil (read max-age))
310 t)))
310 (setq expires (cdr-safe (assoc-string "expires" args t)))) 311 (setq expires (cdr-safe (assoc-string "expires" args t))))
311 (while (consp trusted) 312 (while (consp trusted)
312 (if (string-match (car trusted) current-url) 313 (if (string-match (car trusted) current-url)