[patch] restore trailing null for -root graft point

View: New views
3 Messages — Rating Filter:   Alert me  

[patch] restore trailing null for -root graft point

by Ben Korvemaker-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This was triggered by building using the default compiler (gcc 4.2.1) on
FreeBSD 7, and the latest alpha version (as well as the versions in freebsd
ports). Using 'mkisofs -root myroot -o image.iso MD5SUMS SHA1SUMS', it was
reporting:

mkisofs: Error: 'MD5SUMS' and 'SHA1SUMS' have the same Rock Ridge name 'fsrc'.

For more files, it'd report conflicts for every pair of files.

Regardless of whether or not the argument to -root ends in /, the trailing
null is replaced with a '/'. As the buffer for the graft_point is on the
stack, but not initialized, it may contain other data. Here's a patch to
address this.

--- cdrtools-2.01.01/mkisofs/mkisofs.c 2008-05-18 08:21:25.000000000 -0400
+++ cdrtools-2.01.01-new/mkisofs/mkisofs.c 2008-06-07 21:01:01.000000000 -0400
@@ -3194,8 +3194,10 @@ get_graft(arg, graft_point, glen, nodena
  if (reloc_root != NULL) {
  strlcpy(graft_point, reloc_root, PATH_MAX + 1);
  len = strlen(graft_point);
- if (graft_point[len] != '/')
- graft_point[len++] = '/';
+ if (graft_point[len] != '/') {
+ strncat(graft_point, "/", PATH_MAX +1);
+ len = strlen(graft_point);
+ }
  } else {
  len = 0;
  }

--
Ben Korvemaker
neb@...
_______________________________________________
Cdrecord-developers mailing list
Cdrecord-developers@...
https://lists.berlios.de/mailman/listinfo/cdrecord-developers

Re: [patch] restore trailing null for -root graft point

by Joerg Schilling-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ben Korvemaker <neb@...> wrote:

> This was triggered by building using the default compiler (gcc 4.2.1) on
> FreeBSD 7, and the latest alpha version (as well as the versions in freebsd
> ports). Using 'mkisofs -root myroot -o image.iso MD5SUMS SHA1SUMS', it was
> reporting:
>
> mkisofs: Error: 'MD5SUMS' and 'SHA1SUMS' have the same Rock Ridge name 'fsrc'.
>
> For more files, it'd report conflicts for every pair of files.
>
> Regardless of whether or not the argument to -root ends in /, the trailing
> null is replaced with a '/'. As the buffer for the graft_point is on the
> stack, but not initialized, it may contain other data. Here's a patch to
> address this.

Thank you for imforming me about the problem!

This happens if there is not enough code review for code from "other" people ;-)


> --- cdrtools-2.01.01/mkisofs/mkisofs.c 2008-05-18 08:21:25.000000000 -0400
> +++ cdrtools-2.01.01-new/mkisofs/mkisofs.c 2008-06-07 21:01:01.000000000 -0400
> @@ -3194,8 +3194,10 @@ get_graft(arg, graft_point, glen, nodena
>   if (reloc_root != NULL) {
>   strlcpy(graft_point, reloc_root, PATH_MAX + 1);
>   len = strlen(graft_point);
> - if (graft_point[len] != '/')
> - graft_point[len++] = '/';
> + if (graft_point[len] != '/') {
> + strncat(graft_point, "/", PATH_MAX +1);
> + len = strlen(graft_point);
> + }
>   } else {
>   len = 0;
>   }

strncat() is not in the list of "old" string functions and not in the list
of poratble functions (see libschily).

The next release will be fixed.....

Jörg

--
 EMail:joerg@... (home) Jörg Schilling D-13353 Berlin
       js@...                (uni)  
       schilling@...     (work) Blog: http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily
_______________________________________________
Cdrecord-developers mailing list
Cdrecord-developers@...
https://lists.berlios.de/mailman/listinfo/cdrecord-developers

Re: [patch] restore trailing null for -root graft point

by Ben Korvemaker-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, Jun 08, 2008 at 05:39:47PM +0200, Joerg Schilling wrote:
>
> Thank you for imforming me about the problem!

My pleasure.

> strncat() is not in the list of "old" string functions and not in the list
> of poratble functions (see libschily).

I suspected as much, and hoped the intent was clear enough.

> The next release will be fixed.....

Good to hear!

Ben
--
Ben Korvemaker
neb@...
_______________________________________________
Cdrecord-developers mailing list
Cdrecord-developers@...
https://lists.berlios.de/mailman/listinfo/cdrecord-developers