diff --git a/profiles/input/device.c b/profiles/input/device.c
index 6c152f3..0c71786 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
pdlist = sdp_data_get(rec, 0x0101);
pdlist2 = sdp_data_get(rec, 0x0102);
- if (pdlist) {
- if (pdlist2) {
- if (strncmp(pdlist->val.str, pdlist2->val.str, 5)) {
- strncpy(req->name, pdlist2->val.str, 126);
- strcat(req->name, " ");
- }
- strncat(req->name, pdlist->val.str, 127 - strlen(req->name));
- } else
- strncpy(req->name, pdlist->val.str, 127);
+ if (pdlist && pdlist2 &&
+ strncmp(pdlist->val.str, pdlist2->val.str, 5)) {
+ snprintf(req->name, sizeof(req->name), "%s %s",
+ pdlist2->val.str, pdlist->val.str);
} else {
- pdlist2 = sdp_data_get(rec, 0x0100);
- if (pdlist2)
- strncpy(req->name, pdlist2->val.str, 127);
+ if (!pdlist)
+ pdlist = sdp_data_get(rec, 0x0100);
+
+ if (pdlist)
+ snprintf(req->name, sizeof(req->name), "%s",
+ pdlist->val.str);
}
pdlist = sdp_data_get(rec, SDP_ATTR_HID_PARSER_VERSION);