Skip to content

Commit 03f595b

Browse files
pwhelanedsiper
authored andcommitted
utils: validate allocation before filling with GUID on windows.
Signed-off-by: Phillip Whelan <[email protected]>
1 parent 122f99b commit 03f595b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/flb_utils.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1415,12 +1415,13 @@ int flb_utils_get_machine_id(char **out_id, size_t *out_size)
14151415

14161416
if (status == ERROR_SUCCESS) {
14171417
*out_id = flb_calloc(1, dwBufSize+1);
1418-
memcpy(*out_id, buf, dwBufSize);
14191418

14201419
if (*out_id == NULL) {
14211420
return -1;
14221421
}
14231422

1423+
memcpy(*out_id, buf, dwBufSize);
1424+
14241425
/* RegQueryValueEx sets dwBufSize to strlen()+1 for the NULL
14251426
* terminator, but we only need strlen(). */
14261427
*out_size = dwBufSize-1;

0 commit comments

Comments
 (0)