[LU-12844] error: ‘strncpy’ specified bound depends on the length of the source argument Created: 09/Oct/19  Updated: 21/Nov/19  Resolved: 16/Oct/19

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.13.0, Lustre 2.12.4

Type: Bug Priority: Minor
Reporter: Jian Yu Assignee: Jian Yu
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Related
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

While building Lustre against kernel 4.19.67 on Debian 10, I hit the following failure:

liblnetconfig.c: In function ‘lustre_lnet_parse_nids’:
liblnetconfig.c:320:3: error: ‘strncpy’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
   strncpy(entry, cur, len - 1);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
liblnetconfig.c:310:10: note: length computed here
    len = strlen(cur) + 1;
          ^~~~~~~~~~~
cc1: all warnings being treated as errors


 Comments   
Comment by Gerrit Updater [ 09/Oct/19 ]

Jian Yu (yujian@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/36417
Subject: LU-12844 lnet: fix strncpy bound error
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 63e3b0263cfc936cb91c92abda13c7fb4813d41d

Comment by Gerrit Updater [ 09/Oct/19 ]

Jian Yu (yujian@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/36418
Subject: LU-12844 lnet: fix strncpy bound error
Project: fs/lustre-release
Branch: b2_12
Current Patch Set: 1
Commit: 519581ed81d8d2f12355ec53e0493c61838424b5

Comment by Gerrit Updater [ 16/Oct/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/36417/
Subject: LU-12844 lnet: fix strncpy bound error
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: cebda7a478f9943f10b9a3388377c61a54957a87

Comment by Peter Jones [ 16/Oct/19 ]

Landed for 2.13

Comment by Gerrit Updater [ 21/Nov/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/36418/
Subject: LU-12844 lnet: fix strncpy bound error
Project: fs/lustre-release
Branch: b2_12
Current Patch Set:
Commit: 3dc4d86a6795ae8a6af46af2c9b17c621ec18dde

Generated at Sat Feb 10 02:56:08 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.