Commit 8da4750e authored by Jonathan Neuschäfer's avatar Jonathan Neuschäfer

rtsp_client: strncat -> g_strlcat

The main difference is that strncat takes the maximum number of characters to copy as its third argument, while g_strlcat takes the size of the buffer, which is how the code was using strncat. Incomplete requests may still be constructed as a result of the reqest buffer filling up.
parent d22df291
......@@ -486,35 +486,35 @@ exec_request(struct rtspcl_data *rtspcld, const char *cmd,
if ( rtspcld->session != NULL ) {
sprintf(reql,"Session: %s\r\n", rtspcld->session );
strncat(req,reql,sizeof(req));
g_strlcat(req, reql, sizeof(req));
}
const struct key_data *hd_iter = hds;
while (hd_iter) {
sprintf(reql, "%s: %s\r\n", hd_iter->key, hd_iter->data);
strncat(req, reql, sizeof(req));
g_strlcat(req, reql, sizeof(req));
hd_iter = hd_iter->next;
}
if (content_type && content) {
sprintf(reql, "Content-Type: %s\r\nContent-Length: %d\r\n",
content_type, (int) strlen(content));
strncat(req,reql,sizeof(req));
g_strlcat(req, reql, sizeof(req));
}
sprintf(reql, "User-Agent: %s\r\n", rtspcld->useragent);
strncat(req, reql, sizeof(req));
g_strlcat(req, reql, sizeof(req));
hd_iter = rtspcld->exthds;
while (hd_iter) {
sprintf(reql, "%s: %s\r\n", hd_iter->key, hd_iter->data);
strncat(req, reql, sizeof(req));
g_strlcat(req, reql, sizeof(req));
hd_iter = hd_iter->next;
}
strncat(req, "\r\n", sizeof(req));
g_strlcat(req, "\r\n", sizeof(req));
if (content_type && content)
strncat(req, content, sizeof(req));
g_strlcat(req, content, sizeof(req));
if (!tcp_socket_send(rtspcld->tcp_socket, req, strlen(req))) {
g_set_error(error_r, rtsp_client_quark(), errno,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment