[pgpool-general: 6962] Fix Dead store to local variable
sherlockcpp
sherlockcpp at foxmail.com
Wed Apr 8 20:50:28 JST 2020
Hello,
In function send_complete_and_ready(),
I found the value of 'msg_len' is not read since it was assigned 15.
the code is as follows
---------src/utils/pool_process_reporting.c:121---------------------------
121 if (num_rows >= 0)
122 msg_len = snprintf(msg, 16, "%s %d", message, num_rows);
123 else
124 msg_len = snprintf(msg, 16, "%s", message);
125
126 /*
127 * if we had more than 16 bytes, including '\0', the string was
128 * truncatured shouldn't happen though, as it would means more than
129 * "SELECT 99999999"
130 */
131 if (msg_len > 15)
132 msg_len = 15;
133
134 /* complete command response */
135 pool_write(frontend, "C", 1);
136 if (MAJOR(backend) == PROTO_MAJOR_V3)
137 {
138 len = htonl(4 + strlen(msg) + 1);
139 pool_write(frontend, &len, sizeof(len));
140 }
141 pool_write(frontend, msg, strlen(msg) + 1);
I think 'msg_len' can replace 'strlen(msg)' after it , and I make a patch for it.
Best regards,
sherlockcpp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pgpool.net/pipermail/pgpool-general/attachments/20200408/470cf695/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Fix-Dead-store-to-local-variable.patch
Type: application/octet-stream
Size: 641 bytes
Desc: not available
URL: <http://www.pgpool.net/pipermail/pgpool-general/attachments/20200408/470cf695/attachment.obj>
More information about the pgpool-general
mailing list