2010/3/31 Eric Blake <eblake@xxxxxxxxxx>: > On 03/30/2010 10:20 AM, Matthias Bolte wrote: >> @@ -861,8 +862,10 @@ openvzGetVPSUUID(int vpsid, char *uuidstr, size_t len) >> break; >> } >> >> - sscanf(line, "%s %s\n", iden, uuidbuf); >> - if(STREQ(iden, "#UUID:")) { >> + iden = strtok_r(line, " ", &saveptr); >> + uuidbuf = strtok_r(NULL, "", &saveptr); >> + >> + if (iden != NULL && uuidbuf != NULL && STREQ(iden, "#UUID:")) { > > ACK. > Actually, there is a bug in here. I noticed it while I reviewed this series for the problems you already mentioned. uuidbuf ends up containing VIR_UUID_STRING_BUFLEN + 1 (for the trailing \n) chars. But uuidstr has only room for VIR_UUID_STRING_BUFLEN indicated by len and virStrcpy will fail. If fixed this in v2 of this series by using "\n" as separator for the second strtok_r call. I think I'm going to post v2 later this day. Matthias -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list