summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/cam/cam_xpt.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index 3a3ccc7..36f2214 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -1136,8 +1136,15 @@ xpt_getattr(char *buf, size_t len, const char *attr, struct cam_path *path)
if (idd == NULL)
goto out;
ret = 0;
- if ((idd->proto_codeset & SVPD_ID_CODESET_MASK) == SVPD_ID_CODESET_ASCII ||
- (idd->proto_codeset & SVPD_ID_CODESET_MASK) == SVPD_ID_CODESET_UTF8) {
+ if ((idd->proto_codeset & SVPD_ID_CODESET_MASK) == SVPD_ID_CODESET_ASCII) {
+ if (idd->length < len) {
+ for (l = 0; l < idd->length; l++)
+ buf[l] = idd->identifier[l] ?
+ idd->identifier[l] : ' ';
+ buf[l] = 0;
+ } else
+ ret = EFAULT;
+ } else if ((idd->proto_codeset & SVPD_ID_CODESET_MASK) == SVPD_ID_CODESET_UTF8) {
l = strnlen(idd->identifier, idd->length);
if (l < len) {
bcopy(idd->identifier, buf, l);
OpenPOWER on IntegriCloud