Replace strncpy with memcpy where appropriate.
authorayin <ayin>
Mon, 7 Jan 2008 12:41:31 +0000 (12:41 +0000)
committerayin <ayin>
Mon, 7 Jan 2008 12:41:31 +0000 (12:41 +0000)
src/background.C
src/misc.C
src/rxvtfont.C

index 1ab6504ad3aedb6c58806a51fd0a66847ff03199..9e3dab5aeb67dab4b5c051b47d59ee486c5fdaec 100644 (file)
@@ -276,7 +276,7 @@ bgPixmap_t::set_geometry (const char *geom)
       char *ops;
       new_flags |= geometrySet;
 
-      strncpy (str, geom, n);
+      memcpy (str, geom, n);
       str[n] = '\0';
       if (str[0] == ':')
         ops = &str[0];
@@ -670,7 +670,7 @@ bgPixmap_t::set_file (const char *file)
         {
           size_t len = f - file;
           f = (char *)malloc (len + 1);
-          strncpy (f, file, len);
+          memcpy (f, file, len);
           f[len] = '\0';
           original_asim = get_asimage (target->asimman, f, 0xFFFFFFFF, 100);
           free (f);
index 8e5a0f68266af6c8adf4fc1644fe49296bbd8579..d589b8952e12cb88e9d6bb4f68c0090fa0916d7a 100644 (file)
@@ -287,7 +287,7 @@ rxvt_splitcommastring (const char *cs) NOTHROW
       for ( ; *t && *t != ','; t++) ;
       p = t - s;
       ret[l] = (char *)malloc (p + 1);
-      strncpy (ret[l], s, p);
+      memcpy (ret[l], s, p);
       ret[l][p] = '\0';
       rxvt_strtrim (ret[l]);
       s = ++t;
index 843dfddf3f7f7df54bd6848364a9c55a8c5def14..9aaaef83bce5668b96139e261b002ee4fa8372ad 100644 (file)
@@ -633,7 +633,7 @@ replace_field (char **ptr, const char *name, int index, const char old, const ch
     {
       size_t len = field - name;
       *ptr = (char *)malloc (len + strlen (replace) + strlen (end) + 1);
-      strncpy (*ptr, name, len);
+      memcpy (*ptr, name, len);
       strcpy (*ptr + len, replace);
       strcat (*ptr, end);
 
@@ -1534,7 +1534,7 @@ rxvt_fontset::add_fonts (const char *desc)
 
           if (end - desc < 511)
             {
-              strncpy (buf, desc, end - desc);
+              memcpy (buf, desc, end - desc);
               buf[end - desc] = 0;
 
               fonts.push_back (new_font (buf, cs));