kokoko3k / gopreload

Preloads files needed for given programs.
43 stars 7 forks source link

Potential buffer overflow in main #2

Closed omltorg closed 8 years ago

omltorg commented 8 years ago

line 119 in main may lead to a buffer overflow if /tmp/listpreload.txt contains a line longer than 511 bytes. The line should be replace by (fgets(line, 512, file)) != NULL. To improve code quality the magic number 512 should probably be a const.

kokoko3k commented 8 years ago

i did replace it with: while ((fgets(line, 512, fileLIST)) != NULL) ...but something broke in cachelist(); seems now lstat fails at line 60: if (lstat(line, &buf) <0 )

kokoko3k commented 8 years ago

Well, since gopreload now uses code from fmlock as a replacement for manandlock, this issue is solved.