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

The strcpy writes the terminating null byte as well. #79

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

Conversation

adelton
Copy link

@adelton adelton commented Nov 27, 2020

Addressing

tmpnam.c:48:5: warning: ‘strcpy’ writing one too many bytes into a region of a size that depends on ‘strlen’ [-Wstringop-overflow=]
   48 |     strcpy(ptr2, ptr);
      |     ^~~~~~~~~~~~~~~~~
tmpnam.c:45:12: note: at offset 0 to an object allocated by ‘malloc’ here
   45 |     ptr2 = malloc(strlen(ptr));
      |            ^~~~~~~~~~~~~~~~~~~
  CCLD     libfakechroot.la

Addressing
tmpnam.c:48:5: warning: ‘strcpy’ writing one too many bytes into a region of a size that depends on ‘strlen’ [-Wstringop-overflow=]
   48 |     strcpy(ptr2, ptr);
      |     ^~~~~~~~~~~~~~~~~
tmpnam.c:45:12: note: at offset 0 to an object allocated by ‘malloc’ here
   45 |     ptr2 = malloc(strlen(ptr));
      |            ^~~~~~~~~~~~~~~~~~~
  CCLD     libfakechroot.la
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.

1 participant