Skip to content

Commit

Permalink
#28: Fix buffer overflow bug related to OW memory caching
Browse files Browse the repository at this point in the history
  • Loading branch information
ataffanel committed Feb 6, 2019
1 parent 9789506 commit 48b6509
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ static bool isInit;
static int nMemory;

#ifdef BLE
#define OW_MAX_CACHED 1
#define OW_MAX_CACHED 4
static struct {unsigned char address[8]; unsigned char data[122];} owCache[OW_MAX_CACHED];

static void cacheMemory(int nMem)
{
if (nMemory<OW_MAX_CACHED) {
if (nMem<OW_MAX_CACHED) {
owSerialNum(0, owCache[nMem].address, 1);
ds28e05ReadMemory(0, 0, owCache[nMem].data, 112);
}
Expand Down Expand Up @@ -88,7 +88,7 @@ int owScan()
{
#ifdef BLE
cacheMemory(nMem);
if (nMemory>=OW_MAX_CACHED)
if (nMem>=OW_MAX_CACHED)
break;
#endif
nMem++;
Expand Down

0 comments on commit 48b6509

Please sign in to comment.