File s390-tools-sles11sp2-dasdview-fix-busid-output.patch of Package s390-tools
Description: dasdview: fix printing of random characters after busid
Symptom: When option -i or -x is used to print information about a
device, then the busid in this output is sometimes
followed by random characters.
Problem: The libu2s library function find_busid_in_proc copies a
string without the terminating zero. If this string is
copied into a buffer that contains random data, this data
is later printed as part of the busid.
Solution: Specifying a correct buffer length for the copy command
fixes this problem.
Problem-ID: 75781
---
libu2s/u2s.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/libu2s/u2s.c
+++ b/libu2s/u2s.c
@@ -239,7 +239,7 @@ static int find_busid_in_proc(int maja,
while (fscanf(filp, "%[^(] %*s at ( %d : %d %*[^\n]\n",
bus, &majb, &minb) != EOF) {
if ((maja == majb) && (mina == minb)) {
- strncpy(busid, bus, BUSIDSIZE);
+ strncpy(busid, bus, BUSIDSIZE + 1);
rc = 0;
break;
}