DD_STRUCT_COPY_BYSIZE: Do not clear more that struct size.
This commit is contained in:
parent
69cf835ce0
commit
85cbe8213b
|
@ -45,7 +45,10 @@
|
||||||
do { \
|
do { \
|
||||||
DWORD __size = (to)->dwSize; \
|
DWORD __size = (to)->dwSize; \
|
||||||
DWORD __copysize = __size; \
|
DWORD __copysize = __size; \
|
||||||
memset(to,0,__size); \
|
DWORD __resetsize = __size; \
|
||||||
|
if (__resetsize > sizeof(*to)) \
|
||||||
|
__resetsize = sizeof(*to); \
|
||||||
|
memset(to,0,__resetsize); \
|
||||||
if ((from)->dwSize < __size) \
|
if ((from)->dwSize < __size) \
|
||||||
__copysize = (from)->dwSize; \
|
__copysize = (from)->dwSize; \
|
||||||
memcpy(to,from,__copysize); \
|
memcpy(to,from,__copysize); \
|
||||||
|
|
Loading…
Reference in New Issue