File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,8 @@ defmodule Postgrex do
6868 @ timeout 15_000
6969
7070 @ comment_validation_error Postgrex.Error . exception (
71- message: "`:comment` option cannot contain sequence \" */\" "
71+ message:
72+ "`:comment` option cannot contain null bytes and \" */\" sequence"
7273 )
7374
7475 ### PUBLIC API ###
@@ -336,7 +337,7 @@ defmodule Postgrex do
336337 true
337338
338339 comment when is_binary ( comment ) ->
339- if String . contains? ( comment , "*/" ) do
340+ if String . contains? ( comment , [ << 0 >> , "*/" ] ) do
340341 raise @ comment_validation_error
341342 else
342343 false
Original file line number Diff line number Diff line change @@ -1857,6 +1857,10 @@ defmodule QueryTest do
18571857 assert_raise Postgrex.Error , fn ->
18581858 query ( "select 123" , [ ] , comment: "*/ DROP TABLE 123 --" )
18591859 end
1860+
1861+ assert_raise Postgrex.Error , fn ->
1862+ query ( "select 123" , [ ] , comment: << 0 >> <> "comment" )
1863+ end
18601864 end
18611865
18621866 @ tag :big_binary
You can’t perform that action at this time.
0 commit comments