Skip to content
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

Potential buffer overruns in util functions #98

Open
welcor opened this issue Mar 9, 2021 · 0 comments · May be fixed by #99
Open

Potential buffer overruns in util functions #98

welcor opened this issue Mar 9, 2021 · 0 comments · May be fixed by #99

Comments

@welcor
Copy link
Collaborator

welcor commented Mar 9, 2021

Also, the webster integration is not working.

gcc -g -O2 -Wall -Wno-char-subscripts -Wno-unused-but-set-variable -DCIRCLE_UTIL  -I.. -o ../../bin/autowiz autowiz.c
autowiz.c: In function ‘read_file’:
autowiz.c:85:3: warning: thiswhile’ clause does not guard... [-Wmisleading-indentation]
   85 |   while (get_line(fl, line))
      |   ^~~~~
autowiz.c:88:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while88 |     rewind(fl);
      |     ^~~~~~
gcc -g -O2 -Wall -Wno-char-subscripts -Wno-unused-but-set-variable -DCIRCLE_UTIL  -I.. -o ../../bin/plrtoascii plrtoascii.c
gcc -g -O2 -Wall -Wno-char-subscripts -Wno-unused-but-set-variable -DCIRCLE_UTIL  -I.. -o ../../bin/rebuildIndex rebuildAsciiIndex.c
gcc -g -O2 -Wall -Wno-char-subscripts -Wno-unused-but-set-variable -DCIRCLE_UTIL  -I.. -o ../../bin/rebuildMailIndex rebuildMailIndex.c
gcc -g -O2 -Wall -Wno-char-subscripts -Wno-unused-but-set-variable -DCIRCLE_UTIL  -I.. -o ../../bin/shopconv shopconv.c
shopconv.c: In function ‘main’:
shopconv.c:167:23: warning: ‘%s’ directive writing up to 255 bytes into a region of size 253 [-Wformat-overflow=]
  167 |     sprintf(part, "mv %s %s.tmp", fn, fn);
      |                       ^~          ~~
In file included from /usr/include/stdio.h:867,
                 from ../sysdep.h:69,
                 from shopconv.c:8:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 9 and 519 bytes into a destination of size 256
   36 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   37 |       __bos (__s), __fmt, __va_arg_pack ());
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
shopconv.c:169:22: warning: ‘.tmp’ directive writing 4 bytes into a region of size between 1 and 256 [-Wformat-overflow=]
  169 |     sprintf(part, "%s.tmp", fn);
      |                      ^~~~
In file included from /usr/include/stdio.h:867,
                 from ../sysdep.h:69,
                 from shopconv.c:8:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 5 and 260 bytes into a destination of size 256
   36 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   37 |       __bos (__s), __fmt, __va_arg_pack ());
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
shopconv.c:113:41: warning: ‘%s’ directive writing up to 255 bytes into a region of size 127 [-Wformat-overflow=]
  113 |   sprintf(buf2, "beginning of shop file %s", filename);
      |                                         ^~
......
  180 |       result = boot_the_shops_conv(sfp, nsfp, fn);
      |                                               ~~
In file included from /usr/include/stdio.h:867,
                 from ../sysdep.h:69,
                 from shopconv.c:8:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 24 and 279 bytes into a destination of size 150
   36 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   37 |       __bos (__s), __fmt, __va_arg_pack ());
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
shopconv.c:184:20: warning: ‘%s’ directive writing up to 255 bytes into a region of size 253 [-Wformat-overflow=]
  184 |  sprintf(part, "mv %s.tmp %s", fn, fn);
      |                    ^~          ~~
In file included from /usr/include/stdio.h:867,
                 from ../sysdep.h:69,
                 from shopconv.c:8:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 9 and 519 bytes into a destination of size 256
   36 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   37 |       __bos (__s), __fmt, __va_arg_pack ());
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
shopconv.c:187:20: warning: ‘%s’ directive writing up to 255 bytes into a region of size 253 [-Wformat-overflow=]
  187 |  sprintf(part, "mv %s.tmp %s.bak", fn, fn);
      |                    ^~              ~~
In file included from /usr/include/stdio.h:867,
                 from ../sysdep.h:69,
                 from shopconv.c:8:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 13 and 523 bytes into a destination of size 256
   36 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   37 |       __bos (__s), __fmt, __va_arg_pack ());
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
shopconv.c:119:44: warning: ‘%s’ directive writing up to 255 bytes into a region of size between 119 and 129 [-Wformat-overflow=]
  119 |       sprintf(buf2, "shop #%d in shop file %s", temp, filename);
      |                                            ^~
......
  180 |       result = boot_the_shops_conv(sfp, nsfp, fn);
      |                                               ~~
In file included from /usr/include/stdio.h:867,
                 from ../sysdep.h:69,
                 from shopconv.c:8:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 22 and 287 bytes into a destination of size 150
   36 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   37 |       __bos (__s), __fmt, __va_arg_pack ());
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -g -O2 -Wall -Wno-char-subscripts -Wno-unused-but-set-variable -DCIRCLE_UTIL  -I.. -o ../../bin/sign sign.c 
gcc -g -O2 -Wall -Wno-char-subscripts -Wno-unused-but-set-variable -DCIRCLE_UTIL  -I.. -o ../../bin/split split.c
gcc -g -O2 -Wall -Wno-char-subscripts -Wno-unused-but-set-variable -DCIRCLE_UTIL  -I.. -o ../../bin/wld2html wld2html.c
gcc -g -O2 -Wall -Wno-char-subscripts -Wno-unused-but-set-variable -DCIRCLE_UTIL  -I.. -o ../../bin/webster webster.c
webster.c: In function ‘main’:
webster.c:31:3: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
   31 |   system(buf);
      |   ^~~~~~~~~~~
webster.c: In function ‘get_line’:
webster.c:156:5: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
  156 |     fgets(temp, MEM_USE, fl);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/string.h:495,
                 from ../sysdep.h:74,
                 from webster.c:11:
In function ‘strncpy’,
    inlined from ‘parse_webster_html’ at webster.c:106:9:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ specified bound 10000 equals destination size [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘parse_webster_html’ at webster.c:75:9:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ specified bound 10000 equals destination size [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@welcor welcor linked a pull request Mar 9, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant