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

Replace strncat with strcat #1950

Merged
merged 2 commits into from
Jun 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/scroll.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,11 @@ void print_scroll(struct text_object *obj, char *p, unsigned int p_max_size) {
}

int pwithcolors_len = strlen(p) + 4 + colorchanges - visibcolorchanges;
char *pwithcolors = static_cast<char *>(malloc(pwithcolors_len));
char *pwithcolors = new char[pwithcolors_len];

for (j = 0; j < frontcolorchanges; j++) { pwithcolors[j] = SPECIAL_CHAR; }
pwithcolors[j] = 0;
strncat(pwithcolors, p, pwithcolors_len);
strcat(pwithcolors, p);
unsigned int strend = strlen(pwithcolors);
// and place the colorchanges not in front or in the visible part behind the
// visible part
Copy link
Owner

Choose a reason for hiding this comment

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

Should probably change the free() below to delete pwithcolors.

Expand Down
Loading