Skip to content

Commit

Permalink
<libc> strcpy is now a macro which uses strlcpy
Browse files Browse the repository at this point in the history
- strcpy function has risks buffer overflow, it will now be using
  strlcpy and strlen internally.
  • Loading branch information
akashkollipara authored and pranjalchanda08 committed Dec 21, 2023
1 parent 5f9c8a3 commit d571a37
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion src/lib/libc/include/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,4 @@ char *strchr_rev(const char *i, int r);
* i = destination address
* j = source address
*/
size_t strcpy(char *i, const char *j);
#define strcpy(i, j) strlcpy(i, j, strlen(j));
4 changes: 0 additions & 4 deletions src/lib/libc/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,3 @@ char *strchr_rev(const char *i, int r)
return ret;
}

size_t strcpy(char *i, const char *j)
{
return strlcpy(i, j, strlen(j));
}

0 comments on commit d571a37

Please sign in to comment.