Giter VIP home page Giter VIP logo

gitid's People

Contributors

luiserebii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

azfirefighter

gitid's Issues

Limited User Field Lengths

gitid, up until the current release (and latest commit), has assumed a 1000 character limit on the user, email, and signing key fields. To protect against overwriting the buffers, safestrcpy and safestrcat have been written to define a hard limit. Even runcmd, a function intended to retrieve output from a command, follows this philosophy:

gitid/src/util.c

Lines 33 to 53 in df1e97d

void runcmd(const char* command, int maxline, char* out) {
FILE* proc;
//Process logic in case of failure
if((proc = popen(command, "r")) == NULL) {
perror("popen");
exit(1);
}
//Copy all output to string out
int c;
for(int i = 0; (c = getc(proc)) != EOF && i < maxline - 1; ++i) {
*out++ = c;
}
//Close out
*out = '\0';
//Close process and return
if(pclose(proc) == -1) {
perror("pclose");
exit(1);
}
}

Although the application is prepared to handle these scenarios, they are assumed as accidents, as I had not investigated how long git actually allowed the configurations to be. After building and running the program through gdb, I can safely say that it reads into a kind of dynamically-sized string buffer. The core function is the static get_value: https://github.com/git/git/blob/v2.26.0/config.c#L597 which reads into a string buffer of size_t: https://github.com/git/git/blob/v2.26.0/strbuf.h#L66

The solution here, is to migrate our stack buffers to a dynamically-sized one. There is a string type in C-STL we can use and integrate, although it needs some more work to make it complete.

The best next course of action is to identify the substitutions, get a general idea of the functions needed, develop them, test them, and implement. Success should result in a minor version bump to v0.3.0.

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.