summaryrefslogtreecommitdiff
path: root/usb-dfu-experiment
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-01-08 15:15:56 +0100
committerHarald Welte <laforge@gnumonks.org>2012-01-08 15:15:56 +0100
commiteaf3be4fb75f8dda3e2be044f096338aa3069ba2 (patch)
tree913f23759420cb50c9bec50741addf0e2f7f4b20 /usb-dfu-experiment
parentd6d3d9d1bd8da26cf195099a0c555b23e584f44e (diff)
sam3u unique id: make sure string is zero-terminated
Diffstat (limited to 'usb-dfu-experiment')
-rw-r--r--usb-dfu-experiment/sam3u_chipid_usbserial.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usb-dfu-experiment/sam3u_chipid_usbserial.c b/usb-dfu-experiment/sam3u_chipid_usbserial.c
index c62561e..b81e6b9 100644
--- a/usb-dfu-experiment/sam3u_chipid_usbserial.c
+++ b/usb-dfu-experiment/sam3u_chipid_usbserial.c
@@ -39,11 +39,13 @@ static int to_usb_string(unsigned char *out, int out_len, const char *in)
static int chip_uid_to_usbstring(void)
{
- unsigned long uniqueID[4];
+ unsigned char uniqueID[17];
int rc;
+ memset(uniqueID, 0, sizeof(uniqueID));
+
FLASHD_Initialize(0);
- rc = FLASHD_ReadUniqueID(uniqueID);
+ rc = FLASHD_ReadUniqueID((unsigned long *) uniqueID);
if (rc != 0)
return -EIO;
personal git repositories of Harald Welte. Your mileage may vary