-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(shell) & fix(rebrand & pre-commit): implement config serialization aswell as fix rebrand and pre-commit. #20
Conversation
folder_buffer_size = strlen("/.config/hamon/") + env_size + 1; | ||
folder_buffer = (char *)malloc(folder_buffer_size); | ||
snprintf(folder_buffer, folder_buffer_size, "%s/.config/hamon/", | ||
getenv("HOME")); |
Check warning
Code scanning / Flawfinder (reported by Codacy)
Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. Warning
folder_buffer = (char *)malloc(folder_buffer_size); | ||
snprintf(folder_buffer, folder_buffer_size, "%s\\hamon\\", getenv("APPDATA")); | ||
#elif __linux__ | ||
env_size = strlen(getenv("HOME")); |
Check warning
Code scanning / Flawfinder (reported by Codacy)
Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. Warning
snprintf(folder_buffer, folder_buffer_size, "%s\\hamon\\", getenv("APPDATA")); | ||
#elif __linux__ | ||
env_size = strlen(getenv("HOME")); | ||
folder_buffer_size = strlen("/.config/hamon/") + env_size + 1; |
Check notice
Code scanning / Flawfinder (reported by Codacy)
Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). Note
folder_buffer = (char *)malloc(folder_buffer_size); | ||
snprintf(folder_buffer, folder_buffer_size, "%s\\hamon\\", getenv("APPDATA")); | ||
#elif __linux__ | ||
env_size = strlen(getenv("HOME")); |
Check notice
Code scanning / Flawfinder (reported by Codacy)
Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). Note
|
||
#if _WIN32 | ||
env_size = strlen(getenv("APPDATA")); | ||
folder_buffer_size = strlen("\\hamon\\") + env_size + 1; |
Check notice
Code scanning / Flawfinder (reported by Codacy)
Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). Note
} | ||
|
||
char *read_file(const char *file_path) { | ||
FILE *file = fopen(file_path, "r"); |
Check notice
Code scanning / Flawfinder (reported by Codacy)
Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). Note
#include "headers/file.h" | ||
|
||
int write_file(const char *filename, const char *content, const size_t size) { | ||
FILE *file = fopen(filename, "w"); |
Check notice
Code scanning / Flawfinder (reported by Codacy)
Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). Note
I did all of this through ghcli btw, this tool is nice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 133 should be changed since it's [MS-banned]
…roduce nix-compilation support with .envrc and nix-shell
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is mergable now 🙂
I'm making this pr as I will travel today.
I noticed also the pre-commit config was invalid, but it was too small of a change, so I just injected it into this pr.
I don't remember all I did, but be sure to review it properly, and point out inconsistencies, kthxbye.