Skip to content

Commit

Permalink
- Fixed tolower/toupper malloc off-by-one error
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@5539 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed May 18, 2010
1 parent 536dff0 commit fbc95d6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Compiler/runtime/systemimpl.c
Expand Up @@ -275,7 +275,7 @@ RML_BEGIN_LABEL(System__toupper)
{
char *base = RML_STRINGDATA(rmlA0);
long len = strlen(base);
char *res = (char*) malloc(len);
char *res = (char*) malloc(len+1);
int i;
for (i=0; i<len; i++)
res[i] = toupper(base[i]);
Expand All @@ -292,7 +292,7 @@ RML_BEGIN_LABEL(System__tolower)
{
char *base = RML_STRINGDATA(rmlA0);
long len = strlen(base);
char *res = (char*) malloc(len);
char *res = (char*) malloc(len+1);
int i;
for (i=0; i<len; i++)
res[i] = tolower(base[i]);
Expand Down

0 comments on commit fbc95d6

Please sign in to comment.