changeset 1735:f0b53c4db5ba

Call g_strlcpy() on static name/value buffers instead of strcpy(). Pointed out by ccr.
author William Pitcock <nenolod@atheme.org>
date Tue, 18 Sep 2007 19:39:35 -0500
parents 38375d565192
children 35f8a5fbd1b6
files src/neon/neon.c
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/neon/neon.c	Tue Sep 18 18:03:11 2007 +0200
+++ b/src/neon/neon.c	Tue Sep 18 19:39:35 2007 -0500
@@ -160,13 +160,15 @@
  * -----
  */
 
+#define TAGSIZE 4096
+
 static void parse_icy(struct icy_metadata* m, gchar* metadata, int len) {
 
     gchar* p;
     gchar* tstart;
     gchar* tend;
-    gchar name[4096];
-    gchar value[4096];
+    gchar name[TAGSIZE];
+    gchar value[TAGSIZE];
     int state;
     int pos;
 
@@ -190,7 +192,7 @@
                      * End of tag name.
                      */
                     *p = '\0';
-                    strcpy(name, tstart);
+                    g_strlcpy(name, tstart, TAGSIZE);
                     _DEBUG("Found tag name: %s", name);
                     state = 2;
                 } else {
@@ -219,7 +221,7 @@
                      * End of value
                      */
                     *p = '\0';
-                    strcpy(value, tstart);
+                    g_strlcpy(value, tstart, TAGSIZE);
                     _DEBUG("Found tag value: %s", value);
                     add_icy(m, name, value);
                     state = 4;