New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resizing blockDevPath[] #3

merged 1 commit into from Aug 8, 2017


None yet
2 participants

Remi-p commented Aug 4, 2017

I tried building sdtool on an Archlinux 4.12.3, 32bits.

It failed with the following errors :

$ make
gcc -c -Wall -Werror  src/sdcmd.c -o obj/sdcmd.o
src/sdcmd.c: In function 'sdFindRca':
src/sdcmd.c:107:81: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 235 [-Werror=format-truncation=]
 snprintf (blockDevPath, sizeof(blockDevPath), "/sys/bus/mmc/devices/%s/block/%s", entry->d_name,devname);
src/sdcmd.c:107:13: note: 'snprintf' output 29 or more bytes (assuming 284) into a destination of size 256
             snprintf (blockDevPath, sizeof(blockDevPath), "/sys/bus/mmc/devices/%s/block/%s", entry->d_name,devname);
cc1: all warnings being treated as errors
make: *** [Makefile:53: obj/sdcmd.o] Error 1

Changing the size of char blockDevPath[] (in sdcmd.c) from 256 to something higher than 284 corrected the issue (in this pull request, 512).

@BertoldVdb BertoldVdb merged commit 4165691 into BertoldVdb:master Aug 8, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment