Skip to content

Commit cdf127e

Browse files
authored
Merge pull request #5 from mildred/fix-crash
Fix index out of bounds
2 parents 83454e7 + 234b0ac commit cdf127e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/easy_sqlite3/bindings.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ proc getColumn*(st: ref Statement, idx: int, T: typedesc[string]): string =
528528
let p = sqlite3_column_text(st.raw, idx)
529529
let l = sqlite3_column_bytes(st.raw, idx)
530530
result = newString l
531-
copyMem(addr result[0], p, l)
531+
if l > 0: copyMem(addr result[0], p, l)
532532

533533
proc getColumn*[T](st: ref Statement, idx: int, _: typedesc[Option[T]]): Option[T] =
534534
if st.getColumnType(idx) == dt_null:

0 commit comments

Comments
 (0)