Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0e86672

Browse files
committed
Pass msglen to avoid embedded null problem with strings
1 parenta4445cf commit0e86672

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎src/interfaces/libpqasn1/fe-exec-asn1.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ extern PGresult *PQexecFinish(PGconn *conn);
3232
externboolPQexecStart(PGconn*conn);
3333

3434

35-
intPQsendASNQuery(PGconn*conn,constchar*query);
36-
PGresult*PQASNexec(PGconn*conn,constchar*query);
35+
intPQsendASNQuery(PGconn*conn,constchar*query,constintmsglen);
36+
PGresult*PQASNexec(PGconn*conn,constchar*query,constintmsglen);
3737
voidsymbol_for_ruby_pg(void);
3838

3939

@@ -48,14 +48,14 @@ void symbol_for_ruby_pg(void);
4848
* XXXXX - when is it safe to free bufferInfo / buffer?
4949
*/
5050
int
51-
PQsendASNQuery(PGconn*conn,constchar*query)
51+
PQsendASNQuery(PGconn*conn,constchar*query,constintmsglen)
5252
{
53-
intencoding=0;
53+
intencoding=1;
5454
structbufferInfobufferInfo;
5555

5656
bufferInfo.buffer=query;
57-
bufferInfo.offset=strlen(query);
58-
bufferInfo.length=strlen(query);
57+
bufferInfo.offset=msglen;
58+
bufferInfo.length=msglen;
5959

6060
/* check the argument */
6161
if (!query)
@@ -110,11 +110,11 @@ PQsendASNQuery(PGconn *conn, const char *query)
110110
}
111111

112112
PGresult*
113-
PQASNexec(PGconn*conn,constchar*query)
113+
PQASNexec(PGconn*conn,constchar*query,constintmsglen)
114114
{
115115
if (!PQexecStart(conn))
116116
returnNULL;
117-
if (!PQsendASNQuery(conn,query))
117+
if (!PQsendASNQuery(conn,query,msglen))
118118
returnNULL;
119119
returnPQexecFinish(conn);
120120
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp