mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-09-29 04:18:54 +03:00
Fix offset check in m.get and m.put helpers
This commit is contained in:
@@ -246,7 +246,7 @@ typedef struct avrmem {
|
||||
|
||||
%extend avrmem {
|
||||
PyObject *get(unsigned int len, unsigned int offset = 0) {
|
||||
if (offset > (unsigned)$self->size)
|
||||
if (offset >= (unsigned)$self->size)
|
||||
return Py_None;
|
||||
if (offset + len > (unsigned)$self->size)
|
||||
len = $self->size - offset;
|
||||
@@ -266,7 +266,7 @@ int avr_initmem(const AVRPART *p);
|
||||
if ($self->buf == NULL)
|
||||
// missing avr_initmem()?
|
||||
return 0;
|
||||
if (offset > (unsigned)$self->size)
|
||||
if (offset >= (unsigned)$self->size)
|
||||
return 0;
|
||||
if (offset + len > (unsigned)$self->size)
|
||||
len = $self->size - offset;
|
||||
|
||||
Reference in New Issue
Block a user