summaryrefslogtreecommitdiff
path: root/cleopatre/u-boot-1.1.6
diff options
context:
space:
mode:
Diffstat (limited to 'cleopatre/u-boot-1.1.6')
-rw-r--r--cleopatre/u-boot-1.1.6/net/spidupd.c9
-rw-r--r--cleopatre/u-boot-1.1.6/net/spidupd.h3
2 files changed, 7 insertions, 5 deletions
diff --git a/cleopatre/u-boot-1.1.6/net/spidupd.c b/cleopatre/u-boot-1.1.6/net/spidupd.c
index 8b5ece88d9..409f0416e7 100644
--- a/cleopatre/u-boot-1.1.6/net/spidupd.c
+++ b/cleopatre/u-boot-1.1.6/net/spidupd.c
@@ -88,7 +88,7 @@ struct update_place {
ulong correct_img_exist;
ulong correct_type;
ulong correct_archi;
- char versions[MAX_IMG][16];
+ char versions[MAX_IMG][SPIDUPD_STRING_VERSION_SIZE];
};
/** Informations about image to update */
@@ -318,7 +318,8 @@ static int select_image(int img_nb, ulong img_0_addr, ulong img_max_size, struct
place->correct_type = desc->type;
place->correct_archi = desc->arch;
/* Store the version */
- strncpy(place->versions[i], desc->version, 16);
+ strncpy(place->versions[i], desc->version, SPIDUPD_STRING_VERSION_SIZE);
+ place->versions[i][SPIDUPD_STRING_VERSION_SIZE] = '\0';
break;
case IMAGE_OK_ORIGIN:
@@ -723,7 +724,7 @@ static void SpidupdHandler(uchar *pkt, unsigned dest, unsigned src, unsigned len
int i = 0;
puts("version = ");
- for (i=0; i<16; i++)
+ for (i=0; i<SPIDUPD_STRING_VERSION_SIZE; i++)
{
printf("%c", (vs_update_start_req->version)[i]);
}
@@ -782,7 +783,7 @@ static void SpidupdHandler(uchar *pkt, unsigned dest, unsigned src, unsigned len
break;
}
- if(vs_update_start_req->version[0] == '0')
+ if(vs_update_start_req->version[0] == '\0')
{
printf("Error (Bad Version).\n" );
ctx.modem_busy = 0;
diff --git a/cleopatre/u-boot-1.1.6/net/spidupd.h b/cleopatre/u-boot-1.1.6/net/spidupd.h
index 92aab34a16..2fca618a8e 100644
--- a/cleopatre/u-boot-1.1.6/net/spidupd.h
+++ b/cleopatre/u-boot-1.1.6/net/spidupd.h
@@ -36,6 +36,7 @@
#define MME_MMV 1 /* Management Message Version */
#define SPIDUPD_PROTOCOL_VERSION 1
+#define SPIDUPD_STRING_VERSION_SIZE 16
/*
* SPIDUPD operations
*/
@@ -62,7 +63,7 @@
typedef struct
{
unsigned char proto_version; /* SPiDUpdate protocol version */
- unsigned char version[16]; /* version string of the fw to send */
+ unsigned char version[SPIDUPD_STRING_VERSION_SIZE]; /* version string of the fw to send */
unsigned long arch; /* modem arch type; default: 0 (spc300) */
unsigned long upd_type; /* update type; default: 0 for normal image */
} __attribute__ ((__packed__)) VsUpdStartReq_t;