bug-cpio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-cpio] wanted overflow in code produce gcc warning


From: Ladislav Michnovič
Subject: [Bug-cpio] wanted overflow in code produce gcc warning
Date: Tue, 23 Oct 2007 16:11:57 +0200

Hello.

As it is written in src/tar.h where is explained the header structure
in the commented text
then the file src/tar.c line 220:
      strncpy (tar_hdr->magic + TMAGLEN, TVERSION, TVERSLEN);
can be written this way:
      strncpy (tar_hdr->version, TVERSION, TVERSLEN);

I assume the author intended to copy the TVERSION to tar_hdr->version.
Gcc 4.3 produces  a warning about overflowing which is correct but the
overflow is  wanted.
I would preffer to rewrite it to silent gcc compiler  warnings and it
would be IMHO clearly readable for others. Thank you.

Regards Ladislav.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]