File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 2828#include <string.h>
2929
3030#define CPIO_MAGIC "070701"
31+ #define CPIO_MAGIC_LEN (sizeof(CPIO_MAGIC) - 1)
3132
3233#define CPIO_END "TRAILER!!!"
3334#define CPIO_ENDLEN (sizeof(CPIO_END) - 1)
4142 __func__, ##__VA_ARGS__)
4243
4344struct cpio_header {
44- char c_magic [6 ];
45+ char c_magic [CPIO_MAGIC_LEN ];
4546 char c_ino [8 ];
4647 char c_mode [8 ];
4748 char c_uid [8 ];
@@ -103,7 +104,7 @@ int main(int argc, char **argv)
103104 }
104105
105106 /* check, if this is a cpio archive */
106- if (memcmp (buf .cpio .h .c_magic , CPIO_MAGIC , 6 )) {
107+ if (memcmp (buf .cpio .h .c_magic , CPIO_MAGIC , CPIO_MAGIC_LEN )) {
107108 goto cat_rest ;
108109 }
109110
@@ -138,7 +139,7 @@ int main(int argc, char **argv)
138139 goto end ;
139140 }
140141
141- if (memcmp (buf .cpio .h .c_magic , CPIO_MAGIC , 6 )) {
142+ if (memcmp (buf .cpio .h .c_magic , CPIO_MAGIC , CPIO_MAGIC_LEN )) {
142143 pr_err ("Corrupt CPIO archive!\n" );
143144 goto end ;
144145 }
You can’t perform that action at this time.
0 commit comments