Update of /cvsroot/xine/xine-lib/src/input
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv13083/src/input

Modified Files:
        input_http.c 
Log Message:
Fix wrong length specification for strncat() calls.
Consolidated multiple strncat() calls to snprintf().


Index: input_http.c
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/input/input_http.c,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -r1.124 -r1.125
--- input_http.c        30 Nov 2006 10:54:18 -0000      1.124
+++ input_http.c        8 Dec 2006 16:26:10 -0000       1.125
@@ -335,12 +335,9 @@
           /* prepares the event */
           radio = _x_meta_info_get(this->stream, XINE_META_INFO_ALBUM);
           if (radio) {
-            int len = strlen(radio);
-            strncpy(data.str, radio, sizeof(data.str));
-            strncat(data.str, " - ", sizeof(data.str) - len);
-            strncat(data.str, songtitle, sizeof(data.str) - len - 3);
+           snprintf (data.str, sizeof(data.str), "%s - %s", radio, songtitle);
           } else {
-            strncpy(data.str, songtitle, sizeof(data.str));
+            strncpy(data.str, songtitle, sizeof(data.str)-1);
           }
           data.str[sizeof(data.str) - 1] = '\0';
           data.str_len = strlen(data.str) + 1;
@@ -766,13 +763,11 @@
   }
   
   snprintf(this->buf + buflen, BUFSIZE - buflen,
-           "User-Agent: xine/%s\015\012", VERSION);
-  buflen = strlen(this->buf);
-  strncat (this->buf, "Accept: */*\015\012", BUFSIZE - buflen);
-  buflen = strlen(this->buf);
-  strncat (this->buf, "Icy-MetaData: 1\015\012", BUFSIZE - buflen);
-  buflen = strlen(this->buf);
-  strncat (this->buf, "\015\012", BUFSIZE - buflen);
+           "User-Agent: xine/%s\015\012"
+           "Accept: */*\015\012"
+           "Icy-MetaData: 1\015\012"
+           "\015\012",
+           VERSION);
   buflen = strlen(this->buf);
   if (_x_io_tcp_write (this->stream, this->fh, this->buf, buflen) != buflen) {
     _x_message(this->stream, XINE_MSG_CONNECTION_REFUSED, "couldn't send 
request", NULL);


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Xine-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xine-cvslog

Reply via email to