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

Fix warnings in C code #32

Open
lfborjas opened this issue Jul 6, 2021 · 0 comments
Open

Fix warnings in C code #32

lfborjas opened this issue Jul 6, 2021 · 0 comments

Comments

@lfborjas
Copy link
Owner

lfborjas commented Jul 6, 2021

csrc/configurable_sweephe4.c: In function ‘eph4_posit’:

csrc/configurable_sweephe4.c:555:21: error:
     warning: ‘%s’ directive writing 5 bytes into a region of size between 1 and 256 [-Wformat-overflow=]
      555 |       sprintf(s, "%s%sM%d", ephe4d.ephe4path, EP4_FILE, -filenr);
          |                     ^~
    |
555 |       sprintf(s, "%s%sM%d", ephe4d.ephe4path, EP4_FILE, -filenr);
    |                     ^

csrc/configurable_sweephe4.c:555:18: error:
     note: directive argument in the range [1, 214749]
      555 |       sprintf(s, "%s%sM%d", ephe4d.ephe4path, EP4_FILE, -filenr);
          |                  ^~~~~~~~~
    |
555 |       sprintf(s, "%s%sM%d", ephe4d.ephe4path, EP4_FILE, -filenr);
    |                  ^
In file included from /usr/include/stdio.h:867,
                 from csrc/sweodef.h:169,
                 from csrc/swephexp.h:82,

                 from csrc/configurable_sweephe4.c:60:0: error: 

/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: error:
     note: ‘__builtin___sprintf_chk’ output between 8 and 268 bytes into a destination of size 256
       36 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
    |                     ^

csrc/configurable_sweephe4.c:553:18: error:
     note: directive argument in the range [0, 214748]
      553 |       sprintf(s, "%s%s%d", ephe4d.ephe4path, EP4_FILE, filenr);
          |                  ^~~~~~~~
    |
553 |       sprintf(s, "%s%s%d", ephe4d.ephe4path, EP4_FILE, filenr);
    |                  ^
In file included from /usr/include/stdio.h:867,
                 from csrc/sweodef.h:169,
                 from csrc/swephexp.h:82,

                 from csrc/configurable_sweephe4.c:60:0: error: 

/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: error:
     note: ‘__builtin___sprintf_chk’ output between 7 and 267 bytes into a destination of size 256
       36 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       37 |       __bos (__s), __fmt, __va_arg_pack ());
          |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   |
36 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
   |          ^
csrc/configurable_sweephe4.c: In function ‘ephe4_write_file’:

csrc/configurable_sweephe4.c:990:61: error:
     warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 235 [-Wformat-truncation=]
      990 |           snprintf(errtext, AS_MAXCH, "error in swe_calc(): %s", serr);
          |                                                             ^~   ~~~~
    |
990 |           snprintf(errtext, AS_MAXCH, "error in swe_calc(): %s", serr);
    |                                                             ^
In file included from /usr/include/stdio.h:867,
                 from csrc/sweodef.h:169,
                 from csrc/swephexp.h:82,

                 from csrc/configurable_sweephe4.c:60:0: error: 

/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:10: error:
     note: ‘__builtin___snprintf_chk’ output between 22 and 277 bytes into a destination of size 256
       67 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       68 |        __bos (__s), __fmt, __va_arg_pack ());
          |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   |
67 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
   |          ^
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

No branches or pull requests

1 participant