Skip to content

Several fixes for trunc_gethostname#63

Merged
javalsai merged 2 commits into
javalsai:masterfrom
Ar1gin:trunc-fixes
Jul 16, 2025
Merged

Several fixes for trunc_gethostname#63
javalsai merged 2 commits into
javalsai:masterfrom
Ar1gin:trunc-fixes

Conversation

@Ar1gin

@Ar1gin Ar1gin commented Jul 16, 2025

Copy link
Copy Markdown
Contributor

Problem

Buffer overflow in buf with strcpy in case ELLIPSIS is a multi-byte character

      if (utf8len(buf) > MAXSIZE - utf8len(ELLIPSIS)) {
        strcpy(&buf[MAXSIZE - utf8len(ELLIPSIS)], ELLIPSIS);
        return buf;
      }

Changes

  • trunc_gethostname was completely re-written
  • Additional helper function utf8trunc
  • Hostname buffer is now fixed to HOST_NAME_MAX instead of growing

@javalsai

Copy link
Copy Markdown
Owner

gotta merge #61 for musl builds to be tested one sec

@javalsai

Copy link
Copy Markdown
Owner

and ima merge those changes here to be updated too

@javalsai javalsai left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

lgtm

Comment thread src/ui.c
Comment thread src/ui.c
@grialion

Copy link
Copy Markdown
Collaborator

why the merge commits???

@javalsai javalsai merged commit 8fc6bff into javalsai:master Jul 16, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants