Permalink
Browse files

Merge pull request #119 from francois-berder/develop

Various fixes
  • Loading branch information...
mrehkopf committed Jan 19, 2019
2 parents 21e0b37 + e49edf5 commit 68820a0f37c1740a73a27fbbd862c018b2eea55f
Showing with 7 additions and 1 deletion.
  1. +2 −1 src/fileops.c
  2. +4 −0 src/utils/genhdr.c
  3. +1 −0 src/utils/lpcchksum.c
@@ -118,7 +118,8 @@ FRESULT check_or_create_folder(TCHAR *dir) {
fno.lfname = NULL;
TCHAR buf[256];
TCHAR *ptr = buf;
strncpy(buf, dir, sizeof(buf));
strncpy(buf, dir, sizeof(buf) - 1);
buf[sizeof(buf) - 1] = '\0';
while(*(ptr++)) {
if(*ptr == '/') {
*ptr = 0;
@@ -70,6 +70,7 @@ int main(int argc, char **argv) {

if(flen+256 < flen) {
printf("File too large ;)\n");
fclose(f);
return 1;
}
char *remaining = NULL;
@@ -86,6 +87,8 @@ int main(int argc, char **argv) {
uint8_t *buf = malloc(flen+256);
if(!buf) {
perror("malloc");
fclose(f);
return -1;
}
memset(buf, 0xff, 256);
fseek(f, 0, SEEK_SET);
@@ -122,5 +125,6 @@ int main(int argc, char **argv) {
fseek(f, 0, SEEK_SET);
fwrite(buf, 1, 256+flen, f);
fclose(f);
free(buf);
return 0;
}
@@ -55,6 +55,7 @@ int main(int argc, char **argv) {

if((bin=fopen(argv[1], "wb"))==NULL) {
perror("could not open output file");
free(buffer);
return 1;
}

0 comments on commit 68820a0

Please sign in to comment.