Commit 3cf11d77 authored by Gerald Schaefer's avatar Gerald Schaefer Committed by Martin Schwidefsky

s390/monwriter: fix smatch warning for strcpy()

This patch fixes the following smatch warning:
monwrite_diag() error: strcpy() '"LNXAPPL"' too large for 'id.prod_nr'
(8 vs 7)
Using strcpy() is wrong, because it also copies the terminating null
byte, but in this case the extra copied null byte will be overwritten
right after the strcpy(), so there is no real problem here.
Use strncpy() to fix the warning.
Signed-off-by: default avatarGerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 57f47ba0
...@@ -60,7 +60,7 @@ static int monwrite_diag(struct monwrite_hdr *myhdr, char *buffer, int fcn) ...@@ -60,7 +60,7 @@ static int monwrite_diag(struct monwrite_hdr *myhdr, char *buffer, int fcn)
struct appldata_product_id id; struct appldata_product_id id;
int rc; int rc;
strcpy(id.prod_nr, "LNXAPPL"); strncpy(id.prod_nr, "LNXAPPL", 7);
id.prod_fn = myhdr->applid; id.prod_fn = myhdr->applid;
id.record_nr = myhdr->record_num; id.record_nr = myhdr->record_num;
id.version_nr = myhdr->version; id.version_nr = myhdr->version;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment