|
@@ -537,6 +537,12 @@ int sysfs__read_build_id(const char *filename, void *build_id, size_t size)
|
|
break;
|
|
break;
|
|
} else {
|
|
} else {
|
|
int n = namesz + descsz;
|
|
int n = namesz + descsz;
|
|
|
|
+
|
|
|
|
+ if (n > (int)sizeof(bf)) {
|
|
|
|
+ n = sizeof(bf);
|
|
|
|
+ pr_debug("%s: truncating reading of build id in sysfs file %s: n_namesz=%u, n_descsz=%u.\n",
|
|
|
|
+ __func__, filename, nhdr.n_namesz, nhdr.n_descsz);
|
|
|
|
+ }
|
|
if (read(fd, bf, n) != n)
|
|
if (read(fd, bf, n) != n)
|
|
break;
|
|
break;
|
|
}
|
|
}
|