Git's list of banned C functions

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Access the most powerful time series database as a service
  • SonarQube - Static code analysis for 29 languages.
  • SaaSHub - Software Alternatives and Reviews
  • Git

    Git Source Code Mirror - This is a publish-only repository but pull requests can be turned into patches to the mailing list via GitGitGadget (https://gitgitgadget.github.io/). Please follow Documentation/SubmittingPatches procedure for any of your improvements.

    This gets me interested. Link [1] below shows their implementation of strlcpy(). This is a questionable implementation. With strncpy, the source string "src" may not be NULL terminated IIRC. The git implementation requires "src" to be NULL terminated. Furthermore, imagine "src" has 1Mb characters but we only want to copy the first 3 chars. The git implementation would traverse the entire 1Mb to find the length first.

    [1]: https://github.com/git/git/blob/master/compat/strlcpy.c

  • vscode-gitlens

    Supercharge Git inside VS Code and unlock untapped knowledge within each repository — Visualize code authorship at a glance via Git blame annotations and CodeLens, seamlessly navigate and explore Git repositories, gain valuable insights via rich visualizations and powerful comparison commands, and so much more

    I really wish tooling like this was more common:

    > Current Line Blame; Adds an unobtrusive, customizable, and themable, blame annotation at the end of the current line

    https://github.com/eamodio/vscode-gitlens/tree/v11.2.1#curre...

  • InfluxDB

    Access the most powerful time series database as a service. Ingest, store, & analyze all types of time series data in a fully-managed, purpose-built database. Keep data forever with low-cost storage and superior data compression.

  • safestringlib

    Most of the code I write has a spec of input and output being some form of text. Still, I tend to write that in languages that have safe string handling and drop into C only when the profiler indicates that's useful.

    When handling strings in C, it's useful to use the string functions from glib or pull in one of the specifically safe string handling libraries and not use any C stdlib functions for strings at all.

    There are a number of C strings libraries safer to use than the standard library, and many of them are simpler, more feature-rich, or both.

    * https://github.com/intel/safestringlib (MIT licensed)

  • c-stringbuilder

    A simple StringBuilder in C

    * https://github.com/cavaliercoder/c-stringbuilder (MIT licensed, does dynamic)

    If one does use the C standard library directly for handling strings, the advisories from CERT, NASA, Github, and others should be welcome advice (CERT's advice, BTW, includes recommending a safer strings library right off).

  • mpv

    🎥 Command line video player

    That would be nice. You hit on the other hell with C strings: modern encodings where wchar_t and mb* is useless and replacements essentially don't exist with char8_t, char32_t etc. Then there's the locale chaotic nonsense [1]. A new libc starting fresh would be nice.

    1. https://github.com/mpv-player/mpv/commit/1e70e82baa9193f6f02...

  • SDS

    Simple Dynamic Strings library for C

    Strings have nothing to do with objects. You can write a string library, eg. [sds](https://github.com/antirez/sds). It's just not standard.

  • liblinux

    Linux system calls.

    > A new libc starting fresh would be nice.

    Agreed. I want to make something like this on top of Linux. I discarded the entire libc and started from scratch with freestanding C and nothing but the Linux system call interface. Turns out the Linux system call interface is so much nicer.

    https://github.com/matheusmoreira/liblinux/blob/master/examp...

    I wish I still had the free time to work on this...

  • SonarQube

    Static code analysis for 29 languages.. Your projects are multi-language. So is SonarQube analysis. Find Bugs, Vulnerabilities, Security Hotspots, and Code Smells so you can release quality code every time. Get started analyzing your projects today for free.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts