From 55130d47a0db36950df1563221f654d3378d93a1 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Sat, 11 Dec 2021 00:03:12 +0800 Subject: eww-conf: stringp adds security * eww-conf.el (durand-eww-bookmark-jump): Using stringp to check if a variable is really a string, so that the function that depends on it being a string won't fail unexpectedly (to the user). --- eww-conf.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/eww-conf.el b/eww-conf.el index a8fbd62..aaf48d3 100644 --- a/eww-conf.el +++ b/eww-conf.el @@ -516,14 +516,18 @@ Otherwise, fetch URL and afterwards try to restore the point." (cond (reuse-p (set-buffer reuse-p) - ;; we may use the default handler to restore the position here + ;; we may use the default handler to restore the position + ;; here (with-current-buffer reuse-p (goto-char (cdr position)) (cond - ((search-forward (cdr front) nil t) + ((and + (stringp (cdr front)) + (search-forward (cdr front) nil t)) (goto-char (match-beginning 0)))) (cond - ((search-forward (cdr rear) nil t) + ((and (stringp (cdr rear)) + (search-forward (cdr rear) nil t)) (goto-char (match-end 0)))))) (t ;; HACK, GIANT HACK! -- cgit v1.2.3-18-g5258