From f69e995bdaad29a0faf8d44e9f4b7c591e7ee050 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Mon, 26 Jul 2010 00:06:06 +0000 Subject: [PATCH] Fix potential buffer overflow. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27568 a1c6a512-1295-4272-9138-f99709370657 --- apps/settings.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/settings.c b/apps/settings.c index 938281f4c2..6f1fd7ad2e 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -1211,13 +1211,13 @@ void set_file(const char* filename, char* setting, const int maxlen) else extlen = strlen(extptr); - len = strlen(fptr) - extlen; + len = strlen(fptr) - extlen + 1; /* error if filename isn't in ROCKBOX_DIR */ if (strncasecmp(ROCKBOX_DIR, filename, ROCKBOX_DIR_LEN) || (len > maxlen)) return; - strlcpy(setting, fptr, len+1); + strlcpy(setting, fptr, len); settings_save(); }