diff options
-rw-r--r-- | fs/befs/btree.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/befs/btree.c b/fs/befs/btree.c index a2cd305a993a..9d7d00e04858 100644 --- a/fs/befs/btree.c +++ b/fs/befs/btree.c | |||
@@ -405,7 +405,7 @@ befs_find_key(struct super_block *sb, befs_btree_node * node, | |||
405 | * Heres how it works: Key_no is the index of the key/value pair to | 405 | * Heres how it works: Key_no is the index of the key/value pair to |
406 | * return in keybuf/value. | 406 | * return in keybuf/value. |
407 | * Bufsize is the size of keybuf (BEFS_NAME_LEN+1 is a good size). Keysize is | 407 | * Bufsize is the size of keybuf (BEFS_NAME_LEN+1 is a good size). Keysize is |
408 | * the number of charecters in the key (just a convenience). | 408 | * the number of characters in the key (just a convenience). |
409 | * | 409 | * |
410 | * Algorithm: | 410 | * Algorithm: |
411 | * Get the first leafnode of the tree. See if the requested key is in that | 411 | * Get the first leafnode of the tree. See if the requested key is in that |
@@ -502,12 +502,11 @@ befs_btree_read(struct super_block *sb, befs_data_stream * ds, | |||
502 | "for key of size %d", __func__, bufsize, keylen); | 502 | "for key of size %d", __func__, bufsize, keylen); |
503 | brelse(this_node->bh); | 503 | brelse(this_node->bh); |
504 | goto error_alloc; | 504 | goto error_alloc; |
505 | }; | 505 | } |
506 | 506 | ||
507 | strncpy(keybuf, keystart, keylen); | 507 | strlcpy(keybuf, keystart, keylen + 1); |
508 | *value = fs64_to_cpu(sb, valarray[cur_key]); | 508 | *value = fs64_to_cpu(sb, valarray[cur_key]); |
509 | *keysize = keylen; | 509 | *keysize = keylen; |
510 | keybuf[keylen] = '\0'; | ||
511 | 510 | ||
512 | befs_debug(sb, "Read [%llu,%d]: Key \"%.*s\", Value %llu", node_off, | 511 | befs_debug(sb, "Read [%llu,%d]: Key \"%.*s\", Value %llu", node_off, |
513 | cur_key, keylen, keybuf, *value); | 512 | cur_key, keylen, keybuf, *value); |