- snprintf(buf, DNI_HDR_LEN, "device:%s\nversion:V%s\nregion:%s\n",
- board_id, version, region);
+ pos = snprintf(buf, DNI_HDR_LEN, "device:%s\nversion:V%s\nregion:%s\n",
+ board_id, version, region);
+ rem = DNI_HDR_LEN - pos;
+ if (pos >= 0 && rem > 1 && hd_id) {
+ snprintf(buf + pos, rem, "hd_id:%s\n", hd_id);
+ }