[SeaBIOS] [PATCH 4/8] Fix off by one error in strtcpy.

Kevin O'Connor kevin at koconnor.net
Thu Feb 18 05:40:39 CET 2010


The strtcpy function could overrun its output buffer.
---
 src/util.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/util.c b/src/util.c
index b89a2b5..bbef995 100644
--- a/src/util.c
+++ b/src/util.c
@@ -262,7 +262,7 @@ char *
 strtcpy(char *dest, const char *src, size_t len)
 {
     char *d = dest;
-    while (len-- && *src != '\0')
+    while (--len && *src != '\0')
         *d++ = *src++;
     *d = '\0';
     return dest;
-- 
1.6.6




More information about the SeaBIOS mailing list