Skip to content

Make reveal some warnings #6

Description

@ullenboom
$ make
...
cc -O3   -c parse.c
parse.c: In function ‘getNextToken’:
parse.c:1321:37: warning: ‘%d’ directive writing between 1 and 11 bytes into a region of size between 0 and 6 [-Wformat-overflow=]
 1321 |                 sprintf(name, "@%ld$%d", token->details.number.value.intValue, localSymbolCtrs[token->details.number.value.intValue] + 1);
      |                                     ^~
parse.c:1321:31: note: directive argument in the range [-2147483647, 2147483647]
 1321 |                 sprintf(name, "@%ld$%d", token->details.number.value.intValue, localSymbolCtrs[token->details.number.value.intValue] + 1);
      |                               ^~~~~~~~~
In file included from /usr/include/stdio.h:980,
                 from parse.c:26:
In function ‘sprintf’,
    inlined from ‘getNextToken’ at parse.c:1321:17:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:30:10: note: ‘__builtin___sprintf_chk’ output between 5 and 34 bytes into a destination of size 9
   30 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   31 |                                   __glibc_objsize (__s), __fmt,
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   32 |                                   __va_arg_pack ());
      |                                   ~~~~~~~~~~~~~~~~~
...
cc -O3   -c ldr.c
ldr.c: In function ‘main’:
ldr.c:153:27: warning: ‘%02d’ directive writing between 2 and 11 bytes into a region of size 9 [-Wformat-overflow=]
  153 |     sprintf(currentDate, "%02d/%02d/%02d", tmp->tm_mon + 1, tmp->tm_mday, year);
      |                           ^~~~
ldr.c:153:26: note: directive argument in the range [-2147483647, 2147483647]
  153 |     sprintf(currentDate, "%02d/%02d/%02d", tmp->tm_mon + 1, tmp->tm_mday, year);
      |                          ^~~~~~~~~~~~~~~~
ldr.c:153:26: note: directive argument in the range [-2147483648, 2147483547]
In file included from /usr/include/stdio.h:980,
                 from ldr.c:27:
In function ‘sprintf’,
    inlined from ‘main’ at ldr.c:153:5:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:30:10: note: ‘__builtin___sprintf_chk’ output between 9 and 36 bytes into a destination of size 9
   30 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   31 |                                   __glibc_objsize (__s), __fmt,
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   32 |                                   __va_arg_pack ());
      |                                   ~~~~~~~~~~~~~~~~~
cc  -o ldr ldr.o cosdataset.o fnv32a.o services.o 
cc -O3     -c -o lib.o lib.c
lib.c: In function ‘main’:
lib.c:115:27: warning: ‘%02d’ directive writing between 2 and 11 bytes into a region of size 9 [-Wformat-overflow=]
  115 |     sprintf(currentDate, "%02d/%02d/%02d", tmp->tm_mon + 1, tmp->tm_mday, year);
      |                           ^~~~
lib.c:115:26: note: directive argument in the range [-2147483647, 2147483647]
  115 |     sprintf(currentDate, "%02d/%02d/%02d", tmp->tm_mon + 1, tmp->tm_mday, year);
      |                          ^~~~~~~~~~~~~~~~
lib.c:115:26: note: directive argument in the range [-2147483648, 2147483547]
In file included from /usr/include/stdio.h:980,
                 from lib.c:25:
In function ‘sprintf’,
    inlined from ‘main’ at lib.c:115:5:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:30:10: note: ‘__builtin___sprintf_chk’ output between 9 and 36 bytes into a destination of size 9
   30 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   31 |                                   __glibc_objsize (__s), __fmt,
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   32 |                                   __va_arg_pack ());
      |                                   ~~~~~~~~~~~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions