File tree 2 files changed +7
-2
lines changed
2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,8 @@ defmodule Postgrex do
68
68
@ timeout 15_000
69
69
70
70
@ comment_validation_error Postgrex.Error . exception (
71
- message: "`:comment` option cannot contain sequence \" */\" "
71
+ message:
72
+ "`:comment` option cannot contain null bytes and \" */\" sequence"
72
73
)
73
74
74
75
### PUBLIC API ###
@@ -336,7 +337,7 @@ defmodule Postgrex do
336
337
true
337
338
338
339
comment when is_binary ( comment ) ->
339
- if String . contains? ( comment , "*/" ) do
340
+ if String . contains? ( comment , [ << 0 >> , "*/" ] ) do
340
341
raise @ comment_validation_error
341
342
else
342
343
false
Original file line number Diff line number Diff line change @@ -1857,6 +1857,10 @@ defmodule QueryTest do
1857
1857
assert_raise Postgrex.Error , fn ->
1858
1858
query ( "select 123" , [ ] , comment: "*/ DROP TABLE 123 --" )
1859
1859
end
1860
+
1861
+ assert_raise Postgrex.Error , fn ->
1862
+ query ( "select 123" , [ ] , comment: << 0 >> <> "comment" )
1863
+ end
1860
1864
end
1861
1865
1862
1866
@ tag :big_binary
You can’t perform that action at this time.
0 commit comments