Skip to content

Commit

Permalink
- don't write after the end of the string, read the mkdtemp definitio…
Browse files Browse the repository at this point in the history
…n (template ends in 6 chars which are rewritten in place)

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@24789 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Feb 26, 2015
1 parent 44bbb15 commit 54bb76f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions SimulationRuntime/c/util/omc_msvc.c
Expand Up @@ -182,10 +182,10 @@ char *mkdtemp(char *tpl)
for (i = len; i < len + 6; i++)
{
/* generate random numbers between 0..9 for the last 6 chars of the temp name */
tmpDir[i] = '0' + rand()%10;
tmpDir[i-6] = '0' + rand()%10;
}
/* terminate string */
tmpDir[i] = 0;
tmpDir[i-6] = 0;

mkdir(tmpDir);
return strdup(tmpDir);
Expand Down

0 comments on commit 54bb76f

Please sign in to comment.