Giter Club home page Giter Club logo

Comments (4)

sneves avatar sneves commented on August 30, 2024

I've addressed your first issue in a portable manner. The second one is trickier, since people do not seem to agree on what a bounded sprintf looks like. VS 2015 supports the standard C99 snprintf, but previous versions of VS do not, where _snprintf has different behavior (no null character guaranteed at the end).

Since there is no risk of overflow here, I would probably suggest using the _CRT_SECURE_NO_WARNINGS macro to get around this particular warning.

from phc-winner-argon2.

SparkDustJoe avatar SparkDustJoe commented on August 30, 2024

Does that macro have to be applied globally, or can it be applied per source file? I'm of the mind set that if only a small piece of code throws a security warning, you don't disable that warning for the whole project if it could potentially come up elsewhere in later code changes.

I would agree, in this context, the buffers in question are well contained in code that is not externally or user accessible so the risk is low.

from phc-winner-argon2.

SparkDustJoe avatar SparkDustJoe commented on August 30, 2024

I will also add, in encoding.c and run.c, there are warnings thrown when compiling as x64 instead of Win32, that storing a size_t in a uint32_t or unsigned int could cause possible loss of data.

These are in the definitions of CC_opt and BIN, and in run.c it's only for the line pwdlen = strlen(pwd); which I don't think is an issue in that last case, as most people are going to use passwords less than a few hundred characters (or a key file of less than 1kb).

from phc-winner-argon2.

sneves avatar sneves commented on August 30, 2024

Macro only needs to be applied locally; e.g., put #define _CRT_SECURE_NO_WARNINGS before any includes in src/encoding.c.

I've fixed the warning in src/run.c. The similar warnings in src/encoding.c are inside macros, and the code becomes confusing and difficult to reason about if I just cast to uint32_t. I'll think about a proper fix.

from phc-winner-argon2.

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.