Skip to content

Commit 2b64345

Browse files
committed
fix: wrong hex prefix/postfix for PostgreSQL, insecure break after testing 1024 characters in IsHex
Refs #1980
1 parent dc5c5ab commit 2b64345

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎source/dbconnection.pas‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,8 +2132,8 @@ constructor TPgConnection.Create(AOwner: TComponent);
21322132
begin
21332133
inherited;
21342134
FQuoteChars := '"';
2135-
FHexPrefix := '\x';
2136-
FHexPostfix := '';
2135+
FHexPrefix := '''\x';
2136+
FHexPostfix := '''';
21372137
SetLength(FDatatypes, Length(PostGreSQLDatatypes));
21382138
for i:=0 to High(PostGreSQLDatatypes) do
21392139
FDatatypes[i] := PostGreSQLDatatypes[i];
@@ -6647,8 +6647,6 @@ function TDBConnection.IsHex(Text: String): Boolean;
66476647
if not FHexPostfix.IsEmpty then
66486648
Delete(HexBody, Length(HexBody) - Length(FHexPostfix) + 1, Length(FHexPostfix));
66496649
for i:=1 to Length(HexBody) do begin
6650-
if i > SIZE_KB then
6651-
Break;
66526650
if not CharInSet(HexBody[i], HexChars) then begin
66536651
Result := False;
66546652
Break;

0 commit comments

Comments
 (0)