From ac545f550af7949e232d7a12390f8cecffdd8058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mickae=CC=88l=20Menu?= Date: Sat, 27 Feb 2021 18:15:42 +0100 Subject: [PATCH] Guard against infinite loops with recursive links traversal --- adapter/sqlite/note_dao.go | 3 +++ docs/.zk/config.toml | 1 + docs/external-processing.md | 2 -- docs/style.md | 2 -- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/adapter/sqlite/note_dao.go b/adapter/sqlite/note_dao.go index b3568db..5018fa6 100644 --- a/adapter/sqlite/note_dao.go +++ b/adapter/sqlite/note_dao.go @@ -526,6 +526,9 @@ func (d *NoteDAO) findRows(opts note.FinderOpts) (*sql.Rows, error) { query += fmt.Sprintf(" AND tc.distance < %d", maxDistance) } + // Guard against infinite loops by limiting the number of recursions. + query += "\n LIMIT 100000" + query += "\n)\n" } diff --git a/docs/.zk/config.toml b/docs/.zk/config.toml index 60484a6..3bed872 100644 --- a/docs/.zk/config.toml +++ b/docs/.zk/config.toml @@ -1,4 +1,5 @@ [note] +filename = "{{slug title}}" template = "default.md" [tool] diff --git a/docs/external-processing.md b/docs/external-processing.md index 17bed28..febf1e7 100644 --- a/docs/external-processing.md +++ b/docs/external-processing.md @@ -1,7 +1,5 @@ # Send notes for processing by other programs - - A great way to expand `zk` feature set is to explore a wealth of command-line tools available. You can use `zk`'s powerful [searching and filtering](note-filtering.md) capabilities to select notes before delegating further processing to other programs. ## Process file paths diff --git a/docs/style.md b/docs/style.md index 67dc760..4e20c6d 100644 --- a/docs/style.md +++ b/docs/style.md @@ -1,7 +1,5 @@ # Styling - - `zk` supports a `{{style}}` [template helper](template.md) to format its output with colors and font decorations. Usage: `{{style "" ""}}`