From 8da4750ee2e66647cf774b246e609fe3b8950a11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= Date: Wed, 15 Feb 2012 20:35:06 +0100 Subject: 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. --- src/rtsp_client.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') 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, -- cgit v1.2.3