Am 12.03.2012 12:30, schrieb Floris Bos / Maxnet: > On 03/12/2012 11:26 AM, Stefan Hajnoczi wrote: >> On Sat, Mar 10, 2012 at 7:56 PM, Floris Bos<b...@je-eigen-domein.nl> wrote: >>> @@ -1885,6 +1885,22 @@ int ide_init_drive(IDEState *s, BlockDriverState >>> *bs, IDEDriveKind kind, >>> snprintf(s->drive_serial_str, sizeof(s->drive_serial_str), >>> "QM%05d", s->drive_serial); >>> } >>> + if (model) { >>> + strncpy(s->drive_model_str, model, sizeof(s->drive_model_str)); >> strncpy(3) does not NUL-terminate if the max length is reached. >> Either you need to use pstrcpy() or specify sizeof(s->drive_model_str) >> - 1 and make sure s->drive_model_str[40] = '\0'. > > Thanks for the feedback. > > Will change that line (and serial that used strncpy() as well) to > pstrcpy(), correct the cosmetic issues mentioned by Andreas and submit a > v2 patch.
Fixing serial as well is a good idea. Please submit a separate patch for that, though, as it is an independent fix. Kevin