Skip to content
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

[DRAFT] dlt: Fix compilation warning #634

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

minminlittleshrimp
Copy link
Collaborator

@minminlittleshrimp minminlittleshrimp commented May 20, 2024

  • Add checking for snprintf when parsing data from config file
  • Multiple files logging: Refactor function to optimize memory handling with new log files creation
  • log-storage: strncpy checking

@minminlittleshrimp minminlittleshrimp self-assigned this May 20, 2024
@minminlittleshrimp minminlittleshrimp force-pushed the warning_fix branch 6 times, most recently from e41e1a2 to 1ef1132 Compare May 21, 2024 20:57
@minminlittleshrimp minminlittleshrimp changed the title dlt: Fix compilation warning [DRAFT] dlt: Fix compilation warning May 22, 2024
@minminlittleshrimp minminlittleshrimp force-pushed the warning_fix branch 2 times, most recently from b7fb30c to ea10901 Compare May 26, 2024 15:06
char* file_name = files_buffer->filename;
memset(file_name, 0, length * sizeof(char));
char *f_ptr = files_buffer->filename;
memset(f_ptr, 0, sizeof(files_buffer->filename) * sizeof(char));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sizeof() already returns the size bytes. No need for sizeof(char) here

strncat(files_buffer->filename, MULTIPLE_FILES_FILENAME_INDEX_DELIM, size);

size = size - strlen(MULTIPLE_FILES_FILENAME_INDEX_DELIM);
strncat(files_buffer->filename, file_index, size);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snprintf("%s%s%s...", str1, str2,...") would be better readable here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants