From 6e813353ebe3ccd9e9003f3e5d7d0512b3b7ae1b Mon Sep 17 00:00:00 2001 From: tersec Date: Tue, 28 Jun 2022 11:03:02 +0000 Subject: [PATCH] make some safe cstring conversions explicit (#515) --- eth/db/kvstore_sqlite3.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eth/db/kvstore_sqlite3.nim b/eth/db/kvstore_sqlite3.nim index 61274e3..c49693a 100644 --- a/eth/db/kvstore_sqlite3.nim +++ b/eth/db/kvstore_sqlite3.nim @@ -522,7 +522,7 @@ proc init*( except OSError, IOError: return err("sqlite: cannot create database directory") - checkErr sqlite3_open_v2(name, addr env.val, flags.cint, nil) + checkErr sqlite3_open_v2(cstring name, addr env.val, flags.cint, nil) template checkWalPragmaResult(journalModePragma: ptr sqlite3_stmt) = if (let x = sqlite3_step(journalModePragma); x != SQLITE_ROW): @@ -533,7 +533,7 @@ proc init*( discard sqlite3_finalize(journalModePragma) return err($sqlite3_errstr(x)) - if (let x = sqlite3_column_text(journalModePragma, 0); + if (let x = cstring sqlite3_column_text(journalModePragma, 0); x != "memory" and x != "wal"): discard sqlite3_finalize(journalModePragma) return err("Invalid pragma result: " & $x)