Giter VIP home page Giter VIP logo

cinfo's People

Contributors

jonathanspw avatar mrdotx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

jonathanspw

cinfo's Issues

cinfo.c:47:invalidScanfFormatWidth

cinfo.c:47:13: error: Width 64 given in format string (no. 1) is larger than destination buffer 'g_host[50]', use %49s to prevent overflowing it. [invalidScanfFormatWidth]

Source code is

   if (fscanf(file, "%64s", g_host)) {

but

 g_host[50],

Add versioning/tags

If you'll add versioning and/or tags I will package this for Fedora/EPEL :)

Possible buffer overflows

From build output.

cinfo.c: In function 'get_mem':
cinfo.c:347:76: warning: ']' directive writing 1 byte into a region of size between 0 and 31 [-Wformat-overflow=]
  347 |                 sprintf(g_mem, "%dMiB%s%dMiB [%.1f%%]%s%dMiB%s%dMiB [%.1f%%]", \

cinfo.c: In function 'get_cpu':
cinfo.c:225:29: warning: '%s' directive writing up to 255 bytes into a region of size 47 [-Wformat-overflow=]
  225 |                         "%s/%s", CPU_TEMP_PATH, entry->d_name);
      |                             ^~

cinfo.c: In function 'get_cpu':
cinfo.c:227:26: warning: '%s' directive writing up to 63 bytes into a region of size 48 [-Wformat-overflow=]
  227 |                         "%s/name", temp_path);
      |                          ^~        ~~~~~~~~~
In function 'sprintf',
    inlined from 'get_cpu' at cinfo.c:226:17:
/usr/include/bits/stdio2.h:30:10: note: '__sprintf_chk' output between 6 and 69 bytes into a destination of size 48
   30 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   31 |                                   __glibc_objsize (__s), __fmt,
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   32 |                                   __va_arg_pack ());
      |                                   ~~~~~~~~~~~~~~~~~
cinfo.c: In function 'get_cpu':
cinfo.c:263:35: warning: ' [' directive writing 2 bytes into a region of size between 1 and 65 [-Wformat-overflow=]
  263 |                 sprintf(g_cpu, "%s [%.1f%s]", g_cpu, temp, CPU_TEMP);
      |                                   ^~
In function 'sprintf',
    inlined from 'get_cpu' at cinfo.c:263:17:
/usr/include/bits/stdio2.h:30:10: note: '__sprintf_chk' output between 9 and 382 bytes into a destination of size 65
   30 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   31 |                                   __glibc_objsize (__s), __fmt,
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   32 |                                   __va_arg_pack ());
      |                                   ~~~~~~~~~~~~~~~~~

There are some other instances as well.

This can be recreated by building with -Wformat-overflow

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.