Opened 4 years ago

Last modified 3 years ago

#43632 new defect

cdrtools @3.00_1: mkisofs receives abort trap on Mavericks host if -graft-points option is used

Reported by: galitsyn@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.2.1
Keywords: Cc:
Port: cdrtools

Description

Hi Guys!

The problem might be easily reproduced here if the next command line is executed:

mkisofs -graft-points a=b

This issue occurs on Mavericks (10.9.2) host only and I can't reproduce it on Mountain Lion (10.8.5) host.

I took a look to the ftp://ftp.berlios.de/pub/cdrecord/cdrtools-3.00.tar.bz2 sources and was able to fix it for myself. The patch below fixes the issue:

--- cdrtools-3.00/mkisofs/mkisofs.c.orig        2010-04-25 18:29:03.000000000 +0400
+++ cdrtools-3.00/mkisofs/mkisofs.c     2014-05-08 18:04:33.000000000 +0400
@@ -3235,15 +3235,15 @@
                /*
                 * Remove unwanted "./" & "/" sequences from start...
                 */
+               xpnt = graft_point;
                do {
-                       xpnt = graft_point;
                        while (xpnt[0] == '.' && xpnt[1] == '/')
                                xpnt += 2;
                        while (*xpnt == PATH_SEPARATOR) {
                                xpnt++;
                        }
-                       strlcpy(graft_point, xpnt, glen);
-               } while (xpnt > graft_point);
+               } while (graft_point++ < glen);
+               graft_point = xpnt;
 
                if (node) {
                        node = escstrcpy(nodename, nlen, ++node);

The problem was that strlcpy() used source and destination strings which overlap. Could you please take a look to the issue?

Thank you!

Attachments (1)

cdrtools-3.00-mkisofs.patch (659 bytes) - added by galitsyn@… 4 years ago.
Patch prevents mkisofs from receiving abort trap

Download all attachments as: .zip

Change History (5)

comment:1 Changed 4 years ago by galitsyn@…

Oh, the patch above is not correct =) The below one looks a bit better:

--- cdrtools-3.00/mkisofs/mkisofs.c.orig        2010-04-25 18:29:03.000000000 +0400
+++ cdrtools-3.00/mkisofs/mkisofs.c     2014-05-08 19:25:14.000000000 +0400
@@ -3235,15 +3235,16 @@
                /*
                 * Remove unwanted "./" & "/" sequences from start...
                 */
+               xpnt = graft_point;
+               size_t gidx = 0;
                do {
-                       xpnt = graft_point;
                        while (xpnt[0] == '.' && xpnt[1] == '/')
                                xpnt += 2;
                        while (*xpnt == PATH_SEPARATOR) {
                                xpnt++;
                        }
-                       strlcpy(graft_point, xpnt, glen);
-               } while (xpnt > graft_point);
+               } while ((xpnt[0] == '.' || xpnt[0] == '/') && gidx++ < glen);
+               graft_point = xpnt;
 
                if (node) {
                        node = escstrcpy(nodename, nlen, ++node);

comment:2 Changed 4 years ago by mf2k (Frank Schima)

  • Keywords mkisofs removed
  • Owner changed from macports-tickets@… to bytestorm@…

Please attach your patches to this ticket, not paste them inline.

In the future, please Cc the port maintainers (port info --maintainers cdrtools).

comment:3 Changed 4 years ago by galitsyn@…

Sure, sorry for that. Attaching the last patch.

Changed 4 years ago by galitsyn@…

Patch prevents mkisofs from receiving abort trap

comment:4 Changed 3 years ago by mf2k (Frank Schima)

  • Owner changed from bytestorm@… to macports-tickets@…

This port no longer has a maintainer. See #45212.

Note: See TracTickets for help on using tickets.