mirror of
https://github.com/reactos/reactos.git
synced 2024-10-15 13:45:58 +00:00
Fix buffer overflow in InfpAddSection.
See issue #2516 for more details. svn path=/trunk/; revision=28094
This commit is contained in:
parent
4932311395
commit
5a7f727906
|
@ -181,7 +181,8 @@ InfpAddSection(PINFCACHE Cache,
|
|||
}
|
||||
|
||||
/* Allocate and initialize the new section */
|
||||
Size = sizeof(INFCACHESECTION) + (_tcslen (Name) * sizeof(TCHAR));
|
||||
Size = FIELD_OFFSET(INFCACHESECTION,
|
||||
Name[_tcslen (Name) + 1]);
|
||||
Section = (PINFCACHESECTION)MALLOC (Size);
|
||||
if (Section == NULL)
|
||||
{
|
||||
|
@ -285,7 +286,8 @@ InfpAddFieldToLine(PINFCACHELINE Line,
|
|||
PINFCACHEFIELD Field;
|
||||
ULONG Size;
|
||||
|
||||
Size = sizeof(INFCACHEFIELD) + (_tcslen(Data) * sizeof(TCHAR));
|
||||
Size = FIELD_OFFSET(INFCACHEFIELD,
|
||||
Data[_tcslen(Data) + 1]);
|
||||
Field = (PINFCACHEFIELD)MALLOC(Size);
|
||||
if (Field == NULL)
|
||||
{
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
#ifndef INFPRIV_H_INCLUDED
|
||||
#define INFPRIV_H_INCLUDED
|
||||
|
||||
#ifndef FIELD_OFFSET
|
||||
#define FIELD_OFFSET(t,f) ((ptrdiff_t)&(((t*)0)->f))
|
||||
#endif
|
||||
|
||||
#define INF_STATUS_INSUFFICIENT_RESOURCES (0xC000009A)
|
||||
#define INF_STATUS_BAD_SECTION_NAME_LINE (0xC0700001)
|
||||
|
|
Loading…
Reference in a new issue