diff --git a/src/avr.c b/src/avr.c index eb077b32..3a7d4a9e 100644 --- a/src/avr.c +++ b/src/avr.c @@ -1253,7 +1253,7 @@ void avr_add_mem_order(const char *str) { exit(1); } -int avr_known_mem(const char *str) { +int avr_mem_is_known(const char *str) { for(size_t i=0; i < sizeof avr_mem_order/sizeof *avr_mem_order; i++) if(avr_mem_order[i] && !strcmp(avr_mem_order[i], str)) return 1; diff --git a/src/libavrdude.h b/src/libavrdude.h index cc332ec7..f8bdf682 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -821,7 +821,7 @@ int avr_put_cycle_count(PROGRAMMER * pgm, AVRPART * p, int cycles); void avr_add_mem_order(const char *str); -int avr_known_mem(const char *str); +int avr_mem_is_known(const char *str); #define disable_trailing_ff_removal() avr_mem_hiaddr(NULL) int avr_mem_hiaddr(AVRMEM * mem); diff --git a/src/update.c b/src/update.c index ffddfa16..ee205bbc 100644 --- a/src/update.c +++ b/src/update.c @@ -62,6 +62,12 @@ UPDATE * parse_op(char * s) return upd; } + if (!avr_mem_is_known(buf)) { + avrdude_message(MSG_INFO, "%s: unknown memory type %s\n", progname, buf); + free(upd); + return NULL; + } + upd->memtype = (char *)malloc(strlen(buf)+1); if (upd->memtype == NULL) { avrdude_message(MSG_INFO, "%s: out of memory\n", progname);