git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
feat: a file system mapping for pci devices
[lunaix-os.git]
/
lunaix-os
/
libs
/
klibc
/
string
/
strcpy.c
diff --git
a/lunaix-os/libs/klibc/string/strcpy.c
b/lunaix-os/libs/klibc/string/strcpy.c
index 12586064cd6767fe36abb89139dc4eb2f180a45a..1f7a06d08a928333909ec35d917eeaf08382c42b 100644
(file)
--- a/
lunaix-os/libs/klibc/string/strcpy.c
+++ b/
lunaix-os/libs/klibc/string/strcpy.c
@@
-1,11
+1,11
@@
#include <klibc/string.h>
char*
#include <klibc/string.h>
char*
-strcpy(char* dest, const char* src) {
+strcpy(char* dest, const char* src)
+{
char c;
unsigned int i = 0;
char c;
unsigned int i = 0;
- while ((c = src[i]))
- {
+ while ((c = src[i])) {
dest[i] = c;
i++;
}
dest[i] = c;
i++;
}
@@
-14,10
+14,13
@@
strcpy(char* dest, const char* src) {
}
char*
}
char*
-strncpy(char* dest, const char* src, size_t n) {
+strncpy(char* dest, const char* src, size_t n)
+{
char c;
unsigned int i = 0;
char c;
unsigned int i = 0;
- while ((c = src[i]) && i < n) dest[i++] = c;
- while (i < n) dest[i++] = 0;
+ while ((c = src[i]) && i <= n)
+ dest[i++] = c;
+ while (i <= n)
+ dest[i++] = 0;
return dest;
}
\ No newline at end of file
return dest;
}
\ No newline at end of file