mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 21:32:56 +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
2 changed files with 7 additions and 2 deletions
|
@ -181,7 +181,8 @@ InfpAddSection(PINFCACHE Cache,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate and initialize the new section */
|
/* 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);
|
Section = (PINFCACHESECTION)MALLOC (Size);
|
||||||
if (Section == NULL)
|
if (Section == NULL)
|
||||||
{
|
{
|
||||||
|
@ -285,7 +286,8 @@ InfpAddFieldToLine(PINFCACHELINE Line,
|
||||||
PINFCACHEFIELD Field;
|
PINFCACHEFIELD Field;
|
||||||
ULONG Size;
|
ULONG Size;
|
||||||
|
|
||||||
Size = sizeof(INFCACHEFIELD) + (_tcslen(Data) * sizeof(TCHAR));
|
Size = FIELD_OFFSET(INFCACHEFIELD,
|
||||||
|
Data[_tcslen(Data) + 1]);
|
||||||
Field = (PINFCACHEFIELD)MALLOC(Size);
|
Field = (PINFCACHEFIELD)MALLOC(Size);
|
||||||
if (Field == NULL)
|
if (Field == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,9 @@
|
||||||
#ifndef INFPRIV_H_INCLUDED
|
#ifndef INFPRIV_H_INCLUDED
|
||||||
#define 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_INSUFFICIENT_RESOURCES (0xC000009A)
|
||||||
#define INF_STATUS_BAD_SECTION_NAME_LINE (0xC0700001)
|
#define INF_STATUS_BAD_SECTION_NAME_LINE (0xC0700001)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue