diff --git a/libluna/include/luna/CString.h b/libluna/include/luna/CString.h index 6d17c6e7..d66ab557 100644 --- a/libluna/include/luna/CString.h +++ b/libluna/include/luna/CString.h @@ -23,10 +23,6 @@ extern "C" char* strdup(const char* str); char* strndup(const char* str, usize max); - // Copies len bytes from src into dest and adds a null terminator. - // FIXME: Replace this invented function with strlcpy(). - void nullcpy(char* dest, const char* src, usize len); - usize strlcpy(char* dest, const char* src, usize len); [[deprecated]] char* strcpy(char* dst, const char* src); diff --git a/libluna/src/CString.cpp b/libluna/src/CString.cpp index 38160120..397c911e 100644 --- a/libluna/src/CString.cpp +++ b/libluna/src/CString.cpp @@ -96,12 +96,6 @@ extern "C" return dest; } - void nullcpy(char* dest, const char* src, usize len) - { - memcpy(dest, src, len); - dest[len] = 0; - } - char* strcpy(char* dest, const char* src) { char* s = dest; diff --git a/libluna/src/TarStream.cpp b/libluna/src/TarStream.cpp index 73bb60bd..7667b52e 100644 --- a/libluna/src/TarStream.cpp +++ b/libluna/src/TarStream.cpp @@ -40,7 +40,7 @@ Result TarStream::parse_header(const TarStream::TarHeader* hdr Entry entry; char size[13]; - nullcpy(size, hdr->size, 12); + strlcpy(size, hdr->size, 13); entry.size = parse_unsigned_integer(size, nullptr, 8); entry.mode = (mode_t)parse_unsigned_integer(hdr->mode, nullptr, 8); @@ -56,7 +56,7 @@ Result TarStream::parse_header(const TarStream::TarHeader* hdr default: return err(EFIXME); } - if (!strlen(hdr->prefix)) { nullcpy(entry.name, hdr->name, 100); } + if (!strlen(hdr->prefix)) { strlcpy(entry.name, hdr->name, 101); } else { return err(EFIXME); } if (entry.size)