[PATCH 5/9] qi-fix-strncpy.patch
Andy Green
andy at openmoko.com
Fri Sep 26 14:55:37 CEST 2008
Mini strncpy patch was buggy.
Signed-off-by: Andy Green <andy at openmoko.com>
---
src/utils.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/utils.c b/src/utils.c
index 7e92288..dce53a3 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -59,6 +59,9 @@ char *strncpy(char *dest, const char *src, size_t n)
while (*src && n--)
*dest++ = *src++;
+ if (n)
+ *dest = '\0';
+
return dest_orig;
}
More information about the openmoko-kernel
mailing list