Bug ID 1175565
Summary lvm can't pass build with gcc option Wstringop-overflow
Classification openSUSE
Product openSUSE Tumbleweed
Version Current
Hardware x86-64
OS openSUSE Tumbleweed
Status NEW
Severity Major
Priority P5 - None
Component Basesystem
Assignee screening-team-bugs@suse.de
Reporter heming.zhao@suse.com
QA Contact qa-bugs@suse.de
Found By ---
Blocker ---

when build lvm2-2.03.10 package, the lvmlockd can't pass build. 

warning:
```
[   72s] In function 'strcpy',
[   72s]     inlined from '_store_str' at device_mapper/libdm-common.c:1453:2,
[   72s]     inlined from '_stack_node_op' at
device_mapper/libdm-common.c:1589:2:
[   72s] /usr/include/bits/string_fortified.h:90:10: warning:
'__builtin_strcpy' writing 1 or more bytes into a region of size 0 overflows
the destination [-Wstringop-overflow=]
[   72s]    90 |   return __builtin___strcpy_chk (__dest, __src, __bos
(__dest));
```

the reason is lvm2 use zero-sized array like:
```
struct node_op_parms {
struct dm_list list;
node_op_t type;
char *dev_name;
uint32_t major;
uint32_t minor;
uid_t uid;
gid_t gid;
mode_t mode;
uint32_t read_ahead;
uint32_t read_ahead_flags;
char *old_name;
int warn_if_udev_failed;
unsigned rely_on_udev;
char names[0];
};
```

the last item char names[0] should be changed with flexible array: char names[]


You are receiving this mail because: