NetBSD-Bugs archive

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

bin/44773: Calculation inside sizeof().



>Number:         44773
>Category:       bin
>Synopsis:       Calculation inside sizeof().
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 26 08:20:01 +0000 2011
>Originator:     Henning Petersen
>Release:        NetBSD-current
>Organization:
>Environment:
>Description:
Calculation inside sizeof().
>How-To-Repeat:

>Fix:
diff -u -r1.20 cpio.c
--- bin/pax/cpio.c      14 Feb 2009 08:10:06 -0000      1.20
+++ bin/pax/cpio.c      26 Mar 2011 08:10:13 -0000
@@ -649,8 +649,8 @@
 off_t
 vcpio_endrd(void)
 {
-       return (off_t)(sizeof(HD_VCPIO) + sizeof(TRAILER +
-               (VCPIO_PAD(sizeof(HD_VCPIO) + sizeof(TRAILER)))));
+       return (off_t)(sizeof(HD_VCPIO) + sizeof(TRAILER) +
+               (VCPIO_PAD(sizeof(HD_VCPIO) + sizeof(TRAILER))));
 }
 
 /*
@@ -958,8 +958,8 @@
 off_t
 bcpio_endrd(void)
 {
-       return (off_t)(sizeof(HD_BCPIO) + sizeof(TRAILER +
-               (BCPIO_PAD(sizeof(HD_BCPIO) + sizeof(TRAILER)))));
+       return (off_t)(sizeof(HD_BCPIO) + sizeof(TRAILER) +
+               (BCPIO_PAD(sizeof(HD_BCPIO) + sizeof(TRAILER))));
 }
 
 /*



Home | Main Index | Thread Index | Old Index