Glfw: gcc 7.1.1์˜ ์ปดํŒŒ์ผ๋Ÿฌ ๊ฒฝ๊ณ 

์— ๋งŒ๋“  2017๋…„ 05์›” 29์ผ  ยท  5์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: glfw/glfw

-Wall์„ ์‚ฌ์šฉํ•˜์—ฌ gcc๋ฅผ 7.1.1๋กœ ์—…๋ฐ์ดํŠธํ•œ ํ›„ ์ปดํŒŒ์ผ๋Ÿฌ ๊ฒฝ๊ณ ๊ฐ€ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.
https://github.com/glfw/glfw/blob/master/src/linux_joystick.c#L169
๊ฒฝ๋กœ ๊ธธ์ด๋Š” 20์œผ๋กœ ์„ค์ •๋˜์ง€๋งŒ ์ž ์žฌ์ ์œผ๋กœ 256 + dirname ๋ฌธ์ž ๊ธธ์ด๋ฅผ ํฌํ•จํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ด๊ฒƒ์€ 3.2.1๊ณผ ๊ด€๋ จ์ด ์žˆ์ง€๋งŒ ์ด ์ค„์ด ๋ณ€๊ฒฝ๋˜์ง€ ์•Š์•˜์œผ๋ฏ€๋กœ ์—ฌ์ „ํžˆ ์œ ํšจํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
๊ทธ๋Ÿฐ ๊ฒฝ๊ณ ๋ฅผ ์—†์• ๋ ค๊ณ  ํ•˜๋Š”์ง€ ํ™•์‹คํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

glfw/src/linux_joystick.c:224:46: warning: โ€˜%sโ€™ directive output may be truncated writing up to 255 bytes into a region of size 19 [-Wformat-truncation=] snprintf(path, sizeof(path), "%s/%s", dirname, entry->d_name);
glfw/src/linux_joystick.c:224:13: note: โ€˜snprintfโ€™ output 2 or more bytes (assuming 257) into a destination of size 20 snprintf(path, sizeof(path), "%s/%s", dirname, entry->d_name);

Linux bug verified

๊ฐ€์žฅ ์œ ์šฉํ•œ ๋Œ“๊ธ€

๋ฌธ์ œ๋Š” ์—ฌ์ „ํžˆ ์กด์žฌํ•ฉ๋‹ˆ๋‹ค.

/home/dertarr/Downloads/glfw-3.2.1/src/linux_joystick.c: In function โ€˜_glfwInitJoysticksLinuxโ€™:
/home/dertarr/Downloads/glfw-3.2.1/src/linux_joystick.c:224:46: warning: โ€˜%sโ€™ directive output may be truncated writing up to 255 bytes into a region of size 19 [-Wformat-truncation=]
             snprintf(path, sizeof(path), "%s/%s", dirname, entry->d_name);
                                              ^~
/home/dertarr/Downloads/glfw-3.2.1/src/linux_joystick.c:224:13: note: โ€˜snprintfโ€™ output 2 or more bytes (assuming 257) into a destination of size 20
             snprintf(path, sizeof(path), "%s/%s", dirname, entry->d_name);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

๋ชจ๋“  5 ๋Œ“๊ธ€

๊ทธ๋Ÿฐ ๊ฒฝ๊ณ ๋ฅผ ์—†์• ๋ ค๊ณ  ํ•˜๋Š”์ง€ ํ™•์‹คํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

๊ทธ๋ ‡๋‹ค! ์ ์–ด๋„ -Wall์˜ ๋ชจ๋“  ๊ฒƒ.

์—„์ฒญ๋‚œ. ๋‚˜๋Š” ํฌ๊ธฐ๋ฅผ 512๋กœ ๋Š˜๋ ค์„œ ๋กœ์ปฌ์—์„œ ๊ณ ์ณค์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์กฐ์ด์Šคํ‹ฑ์ด ์—†๊ณ  ์–ด๋””์—์„œ๋‚˜ ๋ถ€์ž‘์šฉ์ด ์žˆ๋Š”์ง€์— ๋Œ€ํ•œ ๋‹จ์„œ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค...

์ ์ ˆํ•œ ์†”๋ฃจ์…˜์—๋Š” pathconf ๋˜๋Š” asnprintf ํฌํ•จ๋  ๊ฒƒ์ž…๋‹ˆ๋‹ค.

๋ฌธ์ œ๋Š” ์—ฌ์ „ํžˆ ์กด์žฌํ•ฉ๋‹ˆ๋‹ค.

/home/dertarr/Downloads/glfw-3.2.1/src/linux_joystick.c: In function โ€˜_glfwInitJoysticksLinuxโ€™:
/home/dertarr/Downloads/glfw-3.2.1/src/linux_joystick.c:224:46: warning: โ€˜%sโ€™ directive output may be truncated writing up to 255 bytes into a region of size 19 [-Wformat-truncation=]
             snprintf(path, sizeof(path), "%s/%s", dirname, entry->d_name);
                                              ^~
/home/dertarr/Downloads/glfw-3.2.1/src/linux_joystick.c:224:13: note: โ€˜snprintfโ€™ output 2 or more bytes (assuming 257) into a destination of size 20
             snprintf(path, sizeof(path), "%s/%s", dirname, entry->d_name);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@dertarr ์œ„์˜ ํŒจ์น˜๋Š” 3.2.1 ๋ฆด๋ฆฌ์Šค ์ดํ›„์— ์ ์šฉ๋œ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰

๊ด€๋ จ ๋ฌธ์ œ

floooh picture floooh  ยท  5์ฝ”๋ฉ˜ํŠธ

neuroscr picture neuroscr  ยท  3์ฝ”๋ฉ˜ํŠธ

~
snbharath picture snbharath  ยท  3์ฝ”๋ฉ˜ํŠธ

malytomas picture malytomas  ยท  3์ฝ”๋ฉ˜ํŠธ

aleck099 picture aleck099  ยท  3์ฝ”๋ฉ˜ํŠธ