summaryrefslogtreecommitdiffstats
path: root/utils/sbtools
diff options
context:
space:
mode:
authorAmaury Pouly <pamaury@rockbox.org>2011-05-13 12:20:49 +0000
committerAmaury Pouly <pamaury@rockbox.org>2011-05-13 12:20:49 +0000
commitbdb8f4c15cd60c7c4f648f1c6ba4bfd7c87383c0 (patch)
tree70f9b4b59524f00a9839625f094268feb1aa92af /utils/sbtools
parenta29ef617f340410c3aaf007ce9c11290486b9749 (diff)
downloadrockbox-bdb8f4c15cd60c7c4f648f1c6ba4bfd7c87383c0.tar.gz
rockbox-bdb8f4c15cd60c7c4f648f1c6ba4bfd7c87383c0.zip
sbtools: fix a few memcpy with overlapping src/dst, fix a parsing bug (would access one byte paste the end of the buffer)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29868 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/sbtools')
-rw-r--r--utils/sbtools/aes128.c2
-rw-r--r--utils/sbtools/elftosb.c2
-rw-r--r--utils/sbtools/sha1.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/utils/sbtools/aes128.c b/utils/sbtools/aes128.c
index d435009a14..5870813db8 100644
--- a/utils/sbtools/aes128.c
+++ b/utils/sbtools/aes128.c
@@ -155,7 +155,7 @@ void EncryptAES(byte *msg, byte *key, byte *c) {
expand_key(key,keys);
// First Round
- memcpy(c, msg, 16);
+ memmove(c, msg, 16);
xor_round_key(c,keys,0);
// Middle rounds
diff --git a/utils/sbtools/elftosb.c b/utils/sbtools/elftosb.c
index f791a4cca0..1b47cb58a0 100644
--- a/utils/sbtools/elftosb.c
+++ b/utils/sbtools/elftosb.c
@@ -307,7 +307,7 @@ static void parse_identifier(char **ptr, char *end, struct lexem_t *lexem)
static void next_lexem(char **ptr, char *end, struct lexem_t *lexem)
{
#define ret_simple(t, advance) ({(*ptr) += advance; lexem->type = t; return;})
- while(true)
+ while(*ptr != end)
{
/* skip whitespace */
if(**ptr == ' ' || **ptr == '\t' || **ptr == '\n' || **ptr == '\r')
diff --git a/utils/sbtools/sha1.c b/utils/sbtools/sha1.c
index 99657fb14a..0ad05bb5cd 100644
--- a/utils/sbtools/sha1.c
+++ b/utils/sbtools/sha1.c
@@ -103,7 +103,7 @@ void sha_1_block(struct sha_1_params_t *params, uint32_t cur_hash[5], byte *data
#define w params->w
- memcpy(w, data, 64);
+ memmove(w, data, 64);
for(int i = 0; i < 16; i++)
byte_swap32(&w[i]);