This repository was archived by the owner on Oct 31, 2024. It is now read-only.
File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -346,8 +346,10 @@ struct name_cache_entry {
346
346
u64 parent_gen ;
347
347
int ret ;
348
348
int need_later_update ;
349
+ /* Name length without NUL terminator. */
349
350
int name_len ;
350
- char name [] __counted_by (name_len );
351
+ /* Not NUL terminated. */
352
+ char name [] __counted_by (name_len ) __nonstring ;
351
353
};
352
354
353
355
/* See the comment at lru_cache.h about struct btrfs_lru_cache_entry. */
@@ -2388,7 +2390,7 @@ static int __get_cur_name_and_parent(struct send_ctx *sctx,
2388
2390
/*
2389
2391
* Store the result of the lookup in the name cache.
2390
2392
*/
2391
- nce = kmalloc (sizeof (* nce ) + fs_path_len (dest ) + 1 , GFP_KERNEL );
2393
+ nce = kmalloc (sizeof (* nce ) + fs_path_len (dest ), GFP_KERNEL );
2392
2394
if (!nce ) {
2393
2395
ret = - ENOMEM ;
2394
2396
goto out ;
@@ -2400,7 +2402,7 @@ static int __get_cur_name_and_parent(struct send_ctx *sctx,
2400
2402
nce -> parent_gen = * parent_gen ;
2401
2403
nce -> name_len = fs_path_len (dest );
2402
2404
nce -> ret = ret ;
2403
- strcpy (nce -> name , dest -> start );
2405
+ memcpy (nce -> name , dest -> start , nce -> name_len );
2404
2406
2405
2407
if (ino < sctx -> send_progress )
2406
2408
nce -> need_later_update = 0 ;
You can’t perform that action at this time.
0 commit comments