diff options
| author | Nils Wallménius <nils@rockbox.org> | 2009-07-14 13:57:45 +0000 |
|---|---|---|
| committer | Nils Wallménius <nils@rockbox.org> | 2009-07-14 13:57:45 +0000 |
| commit | 3d4701a6e41616cf581a297bab1451cf2db70249 (patch) | |
| tree | f845837c96ffbed7d59ddf8308f3b3e7c40cb8c9 /apps/plugins/keybox.c | |
| parent | c2900a1bacd5d98b57a0d15ea2add1bc08764057 (diff) | |
| download | rockbox-3d4701a6e41616cf581a297bab1451cf2db70249.zip rockbox-3d4701a6e41616cf581a297bab1451cf2db70249.tar.gz rockbox-3d4701a6e41616cf581a297bab1451cf2db70249.tar.bz2 rockbox-3d4701a6e41616cf581a297bab1451cf2db70249.tar.xz | |
FS#10080
* Move strncpy() from core to the pluginlib
* Introduce strlcpy() and use that instead in most places (use memcpy in a few) in core and some plugins
* Drop strncpy() from the codec api as no codec used it
* Bump codec and plugin api versions
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21863 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/keybox.c')
| -rw-r--r-- | apps/plugins/keybox.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/apps/plugins/keybox.c b/apps/plugins/keybox.c index 08d5131..73fd138 100644 --- a/apps/plugins/keybox.c +++ b/apps/plugins/keybox.c @@ -330,11 +330,11 @@ static void hash_pw(union hash *out) static void make_key(void) { int i; - char buf[sizeof(master_pw) + sizeof(salt) + 1]; + char buf[sizeof(master_pw) + sizeof(salt) + 1] = {0}; struct md5_s key_md5; size_t len = rb->strlen(master_pw); - rb->strncpy(buf, master_pw, sizeof(buf)); + rb->strlcpy(buf, master_pw, sizeof(buf)); rb->memcpy(&buf[len], &salt, sizeof(salt)); @@ -418,7 +418,7 @@ static int parse_buffer(void) break; } - rb->strncpy(entry->title, start, FIELD_LEN); + rb->strlcpy(entry->title, start, FIELD_LEN); start = end + 1; end = rb->strchr(start, '\0'); /* find eol */ @@ -428,7 +428,7 @@ static int parse_buffer(void) break; } - rb->strncpy(entry->name, start, FIELD_LEN); + rb->strlcpy(entry->name, start, FIELD_LEN); start = end + 1; end = rb->strchr(start, '\0'); /* find eol */ @@ -437,7 +437,7 @@ static int parse_buffer(void) { break; } - rb->strncpy(entry->password, start, FIELD_LEN); + rb->strlcpy(entry->password, start, FIELD_LEN); start = end + 1; entry->used = true; if (i + 1 < MAX_ENTRIES - 1) @@ -469,13 +469,13 @@ static void write_output(int fd) for (i = 0; i < pw_list.num_entries; i++) { len = rb->strlen(entry->title); - rb->strncpy(p, entry->title, len+1); + rb->strlcpy(p, entry->title, len+1); p += len+1; len = rb->strlen(entry->name); - rb->strncpy(p, entry->name, len+1); + rb->strlcpy(p, entry->name, len+1); p += len+1; len = rb->strlen(entry->password); - rb->strncpy(p, entry->password, len+1); + rb->strlcpy(p, entry->password, len+1); p += len+1; if (entry->next) entry = entry->next; @@ -517,7 +517,7 @@ static int enter_pw(char *pw_buf, size_t buflen, bool new_pw) } else { - rb->strncpy(pw_buf, buf[0], buflen); + rb->strlcpy(pw_buf, buf[0], buflen); hash_pw(&pwhash); return 0; } |