File vcdimager-0.7.23-strncat.patch of Package vcdimager

Index: vcdimager-0.7.23/frontends/xml/vcd_xml_rip.c
===================================================================
--- vcdimager-0.7.23.orig/frontends/xml/vcd_xml_rip.c
+++ vcdimager-0.7.23/frontends/xml/vcd_xml_rip.c
@@ -158,7 +158,7 @@ _parse_isofs_r (vcdxml_t *p_vcdxml, CdIo
       char *_name = statbuf->filename;
 
       strncpy (_fullname, pathname, sizeof (_fullname));
-      strncat (_fullname, _name, sizeof (_fullname));
+      strncat (_fullname, _name, sizeof (_fullname)-strlen(_fullname)-1);
 
       if (NULL == statbuf)
 	return -1;
@@ -177,7 +177,7 @@ _parse_isofs_r (vcdxml_t *p_vcdxml, CdIo
       _register_file (p_vcdxml, _fullname, statbuf);
 
       if (statbuf->type == _STAT_DIR) {
-	strncat (_fullname, "/", sizeof (_fullname));
+	strncat (_fullname, "/", sizeof (_fullname)-strlen(_fullname)-1);
 	if (_parse_isofs_r (p_vcdxml, p_cdio, _fullname)) {
 	  return -1;
 	}
Index: vcdimager-0.7.23/frontends/cli/vcd-info.c
===================================================================
--- vcdimager-0.7.23.orig/frontends/cli/vcd-info.c
+++ vcdimager-0.7.23/frontends/cli/vcd-info.c
@@ -943,7 +943,7 @@ _dump_fs_recurse (const vcdinfo_obj_t *o
 
       snprintf (_fullname, sizeof (_fullname), "%s%s", pathname, _name);
   
-      strncat (_fullname, "/", sizeof (_fullname));
+      strncat (_fullname, "/", sizeof (_fullname)-strlen(_fullname)-1);
 
       if (statbuf->type == _STAT_DIR
           && strcmp (_name, ".") 
Index: vcdimager-0.7.23/frontends/xml/vcd_xml_build.c
===================================================================
--- vcdimager-0.7.23.orig/frontends/xml/vcd_xml_build.c
+++ vcdimager-0.7.23/frontends/xml/vcd_xml_build.c
@@ -275,7 +275,7 @@ _do_cl (int argc, const char *argv[])
 	{
 	  char buf[1024] = { 0, };
 	  strncpy (buf, opt_arg, sizeof (buf));
-	  strncat (buf, ".toc", sizeof (buf));
+	  strncat (buf, ".toc", sizeof (buf)-strlen(buf)-1);
 
 	  _set_img_opt ("toc", buf);
 	}
Index: vcdimager-0.7.23/lib/vcd.c
===================================================================
--- vcdimager-0.7.23.orig/lib/vcd.c
+++ vcdimager-0.7.23/lib/vcd.c
@@ -1682,7 +1682,7 @@ _write_sequence (VcdObj_t *p_obj, int tr
                                   track->info->ahdr[i].bitrate / 1024,
                                   _mode_str[track->info->ahdr[i].mode]);
                     
-            strncat (buf2, buf, sizeof(buf2)-i_buf2);
+            strncat (buf2, buf, sizeof(buf2)-strlen(buf2)-i_buf2-1);
             i_buf2 += i_buf;
           }      
 
openSUSE Build Service is sponsored by