2 Commits
Author SHA1 Message Date
Pali Rohár a6ec475a92 Merge branch 'pvc' into legacy 2013-01-14 19:30:10 +01:00
pancake a6ef73359c * Apply security patches from Erik Hovland - Thanks! 2008-12-19 19:39:27 +01:00
9 changed files with 27 additions and 12 deletions

No files matched your search

+4
View File
@@ -7,3 +7,7 @@ LDFLAGS+=-L/usr/pkg/lib -Wl,-R/usr/pkg/lib
HAVE_USB=1 HAVE_USB=1
HAVE_GUI=1 HAVE_GUI=1
# For linking against this copy of libusb
#CFLAGS+=-I../libusb
+1
View File
@@ -60,6 +60,7 @@ int compress_image(char *srcf, char *dstf, int w, int h)
fdout = open( dstf, O_TRUNC | O_CREAT | O_WRONLY , 0660 ); fdout = open( dstf, O_TRUNC | O_CREAT | O_WRONLY , 0660 );
if (fdout == -1) { if (fdout == -1) {
printf("Cannot open file '%s' for writing\n", dstf); printf("Cannot open file '%s' for writing\n", dstf);
fclose(fd);
return 1; return 1;
} }
+2
View File
@@ -107,5 +107,7 @@ int rgb2yuv(char *from, char *to, int width, int height)
for ( i = 0 ; i < height ; i+=2 ) for ( i = 0 ; i < height ; i+=2 )
for ( j = 0; j < width ; j +=2 ) for ( j = 0; j < width ; j +=2 )
write ( fout,&dstV[j+(i*width)], 1); write ( fout,&dstV[j+(i*width)], 1);
free(dstV); free(dstU); free(dstY); free(src);
return 1; return 1;
} }
+1
View File
@@ -119,5 +119,6 @@ int uncompress_image(char *srcf, char *dstf)
//printf("logotool -w %d -h %d -v %s\n", width, height, dstf); //printf("logotool -w %d -h %d -v %s\n", width, height, dstf);
printf("eval PATH=$PWD:$PATH logotool -w %d -h %d -m %s\n", width, height, dstf); printf("eval PATH=$PWD:$PATH logotool -w %d -h %d -m %s\n", width, height, dstf);
free(dst); free(src);
return 0; return 0;
} }
+4 -4
View File
@@ -69,17 +69,14 @@ __rf_extract_exit:
* This function was covardly copied from nanddump.c @ mtd-utils-20060907 * This function was covardly copied from nanddump.c @ mtd-utils-20060907
*/ */
#define _GNU_SOURCE #define _GNU_SOURCE
#include <ctype.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <unistd.h> #include <unistd.h>
#include <getopt.h> #include <getopt.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h>
//#include <asm/types.h> //#include <asm/types.h>
#include <mtd/mtd-user.h> #include <mtd/mtd-user.h>
#ifndef loff_t #ifndef loff_t
@@ -172,6 +169,9 @@ int check_badblocks(char *mtddev)
return 1; return 1;
} }
memset(&stat1, 0, sizeof(stat1));
memset(&stat2, 0, sizeof(stat2));
fprintf(stderr, "Block size %u, page size %u, OOB size %u\n", fprintf(stderr, "Block size %u, page size %u, OOB size %u\n",
meminfo.erasesize, meminfo.writesize, meminfo.oobsize); meminfo.erasesize, meminfo.writesize, meminfo.oobsize);
fprintf(stderr, "Size %u, flags %u, type 0x%x\n", fprintf(stderr, "Size %u, flags %u, type 0x%x\n",
@@ -513,7 +513,7 @@ int dump_config()
break; break;
if (!memcmp(buf,"ConF", 4)) { if (!memcmp(buf,"ConF", 4)) {
loop: loop:
read(fd, buf, 4); ret = read(fd, buf, 4);
if (ret == -1) break; if (ret == -1) break;
printf("\n0x%08x : ConF %02x %02x %02x %02x : ", i, printf("\n0x%08x : ConF %02x %02x %02x %02x : ", i,
buf[0], buf[1], buf[2], buf[3]); buf[0], buf[1], buf[2], buf[3]);
+6 -1
View File
@@ -42,7 +42,12 @@ long fpid_size(const char *filename)
{ {
long sz; long sz;
FILE *fd = fopen(filename, "r"); FILE *fd = fopen(filename, "r");
fseek(fd, 0, SEEK_END); if (fd == NULL)
return -1;
if (fseek(fd, 0, SEEK_END) != 0) {
fclose(fd);
return -1;
}
sz = ftell(fd); sz = ftell(fd);
fclose(fd); fclose(fd);
return sz; return sz;
+3 -1
View File
@@ -44,8 +44,10 @@ usho do_hash_file(const char *filename, const char *type)
do { do {
ret = fread(&buf, 1, BSIZE, fd); ret = fread(&buf, 1, BSIZE, fd);
if (ret == -1) if (ret == -1) {
fclose(fd);
return 0; return 0;
}
hash ^= do_hash((usho *)&buf, ret); hash ^= do_hash((usho *)&buf, ret);
} while(ret); } while(ret);
-5
View File
@@ -43,13 +43,11 @@ void process_message(char *msg)
{ {
char *str; char *str;
char *arg; char *arg;
int c=1;
if (msg == NULL) if (msg == NULL)
return; return;
printf("[x] (%s)\n", msg); printf("[x] (%s)\n", msg);
str = strdup(msg); str = strdup(msg);
arg = strchr(str, ':'); arg = strchr(str, ':');
if (c!=0) {
arg[0]='\0'; arg[0]='\0';
arg = arg +1; arg = arg +1;
if (!strcmp(str, "flash")) { if (!strcmp(str, "flash")) {
@@ -72,9 +70,6 @@ void process_message(char *msg)
squeue_push2(p, "info", strbuf, 1); squeue_push2(p, "info", strbuf, 1);
} else } else
squeue_push2(p, "error", "invalid command", 0); squeue_push2(p, "error", "invalid command", 0);
} else {
squeue_push2(p, "error", "invalid command format", 0);
}
free(str); free(str);
} }
+6 -1
View File
@@ -40,13 +40,18 @@ struct squeue_t *squeue_open(const char *file, int mode)
struct squeue_t *q; struct squeue_t *q;
char *pool; char *pool;
int shmid; int shmid;
int fd;
key_t k; key_t k;
k = ftok(file, 0x34); k = ftok(file, 0x34);
if (k == -1) { if (k == -1) {
perror("ftok"); perror("ftok");
squeue_release(file); squeue_release(file);
close(creat(file, 0666)); if ((fd = creat(file, 0666)) == -1) {
perror("creat");
return NULL;
}
close(fd);
chmod(file, 0666); chmod(file, 0666);
k = ftok(file, 0xa3); k = ftok(file, 0xa3);
if (k == -1) { if (k == -1) {