Skip to content

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

Open
adelton wants to merge 1 commit intodex4er:masterfrom
adelton:strcpy-fix
Open

The strcpy writes the terminating null byte as well.#79
adelton wants to merge 1 commit intodex4er:masterfrom
adelton:strcpy-fix

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