Giter Club home page Giter Club logo

Comments (2)

n3f4s avatar n3f4s commented on July 18, 2024

Hi,
The error is:

source/gamelib/packfile.c: In function 'casesearch':
source/gamelib/packfile.c:324:33: error: 'sprintf' may write a terminating nul past the end of the destination [-Werror=format-overflow=]
         sprintf(fullpath, "%s/%s", dir, entry->d_name);
                                 ^
source/gamelib/packfile.c:324:9: note: 'sprintf' output 2 or more bytes (assuming 257) into a destination of size 256
         sprintf(fullpath, "%s/%s", dir, entry->d_name);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:655: source/gamelib/packfile.o] Error 1

It's caused by the fact that the size of dir added to the size of entry->d_name is greater than 256 (the size of fullpath).
Since the overflow is an undefined behaviour (and not an error), the compiler issue just a warning.
-Werror cause transform the warning into errors. That's why the build is a success without it (even if there are warnings). The error is not fixed. The overflow is still there, hence the intermittent segfault.

from openbor.

DCurrent avatar DCurrent commented on July 18, 2024

Sorry, I missed this issue before. I increased the size of fullpath in 5ae15ba. See if that helps.

from openbor.

Related Issues (20)

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.