aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>2012-02-15 20:35:06 +0100
committerJonathan Neuschäfer <j.neuschaefer@gmx.net>2012-02-15 20:37:29 +0100
commit8da4750ee2e66647cf774b246e609fe3b8950a11 (patch)
treef4e8e33afbae2e869a16953b10408c71afae4330
parentd22df2915ce5005e6789f0cd4d188e56432264a7 (diff)
downloadmpd-8da4750ee2e66647cf774b246e609fe3b8950a11.tar.gz
mpd-8da4750ee2e66647cf774b246e609fe3b8950a11.tar.xz
mpd-8da4750ee2e66647cf774b246e609fe3b8950a11.zip
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.
-rw-r--r--src/rtsp_client.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/rtsp_client.c b/src/rtsp_client.c
index 66b7244a2..ea993a163 100644
--- a/src/rtsp_client.c
+++ b/src/rtsp_client.c
@@ -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,