Module: check_mk
Branch: master
Commit: 11b60e3b6ddf231923db68c9985d5248294a9f76
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=11b60e3b6ddf23…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Oct 22 15:16:07 2013 +0200
Fixed validation problem on del_bookmark page
---
web/htdocs/sidebar.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/web/htdocs/sidebar.py b/web/htdocs/sidebar.py
index 8435f4e..672c2af 100644
--- a/web/htdocs/sidebar.py
+++ b/web/htdocs/sidebar.py
@@ -557,9 +557,15 @@ def ajax_switch_masterstate():
html.write(_("Command %s/%d not found") % (column, state))
def ajax_del_bookmark():
- num = int(html.var("num"))
+ try:
+ num = int(html.var("num"))
+ except ValueError:
+ raise MKGeneralException(_("Invalid bookmark id."))
bookmarks = load_bookmarks()
- del bookmarks[num]
+ try:
+ del bookmarks[num]
+ except IndexError:
+ raise MKGeneralException(_("Unknown bookmark id: %d. This is probably a
problem with reload or browser history. Please try again.") %
htmllib.attrencode(num))
save_bookmarks(bookmarks)
render_bookmarks()
@@ -591,7 +597,7 @@ def page_edit_bookmark():
raise MKGeneralException(_("Invalid bookmark id."))
bookmarks = load_bookmarks()
if n >= len(bookmarks):
- raise MKGeneralException(_("Unknown bookmark id: %d. This is probably a
problem with reload or browser history. Please try again.") % n)
+ raise MKGeneralException(_("Unknown bookmark id: %d. This is probably a
problem with reload or browser history. Please try again.") % htmllib.attrencode(n))
if html.var("save") and html.check_transaction():
title = html.var("title")