Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

gcc7 util.c - ‘%s’ directive writing up to 255 bytes into a region of size 232 #309

@gtirloni

Description

@gtirloni

Environment

Fedora 26 x86_64
gcc 7.1.1
git hash faef420

Error

gcc -DHAVE_CONFIG_H -I. -I..    -Wall -Werror -DVERSIONCOMMIT=\""0.8.1, commit: `git describe --dirty --always --tags 2> /dev/null || true`"\" -g -O2 -MT util.o -MD -MP -MF $depbase.Tpo -c -o util.o util.c &&\
mv -f $depbase.Tpo $depbase.Po
util.c: In function ‘online_cpu’:
util.c:514:42: error: ‘%s’ directive writing up to 255 bytes into a region of size 232 [-Werror=format-overflow=]
   sprintf(path, "/sys/devices/system/cpu/%s/online", entry->d_name);
                                          ^~
util.c:514:3: note: ‘sprintf’ output between 32 and 287 bytes into a destination of size 256
   sprintf(path, "/sys/devices/system/cpu/%s/online", entry->d_name);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
util.c: In function ‘online_memory’:
util.c:550:45: error: ‘%s’ directive writing up to 255 bytes into a region of size 229 [-Werror=format-overflow=]
   sprintf(path, "/sys/devices/system/memory/%s/online", entry->d_name);
                                             ^~
util.c:550:3: note: ‘sprintf’ output between 35 and 290 bytes into a destination of size 256
   sprintf(path, "/sys/devices/system/memory/%s/online", entry->d_name);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions