Skip to content

Commit 6cb103b

Browse files
Fabian Fredericktorvalds
authored andcommitted
fs/befs/btree.c: replace strncpy by strlcpy + coding style fixing
- strncpy + end of string assignement replaced by strlcpy - Fix endif }; - Fix typo Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 39d7a29 commit 6cb103b

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎fs/befs/btree.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ befs_find_key(struct super_block *sb, befs_btree_node * node,
405405
* Heres how it works: Key_no is the index of the key/value pair to
406406
* return in keybuf/value.
407407
* 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).
409409
*
410410
* Algorithm:
411411
* 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,
502502
"for key of size %d", __func__, bufsize, keylen);
503503
brelse(this_node->bh);
504504
goto error_alloc;
505-
};
505+
}
506506

507-
strncpy(keybuf, keystart, keylen);
507+
strlcpy(keybuf, keystart, keylen + 1);
508508
*value = fs64_to_cpu(sb, valarray[cur_key]);
509509
*keysize = keylen;
510-
keybuf[keylen] = '\0';
511510

512511
befs_debug(sb, "Read [%llu,%d]: Key \"%.*s\", Value %llu", node_off,
513512
cur_key, keylen, keybuf, *value);

0 commit comments

Comments
 (0)