]> git.sur5r.net Git - u-boot/blobdiff - common/hash.c
libfdt: Fix segfault when calling fit_check_format() on corrupt FIT images
[u-boot] / common / hash.c
index 7627b84b451421a599f378511eccd71639e450fe..237bd04bb12e67fe95542b9068a5ef2eb12a4a3c 100644 (file)
@@ -214,7 +214,7 @@ static void store_result(struct hash_algo *algo, const u8 *sum,
                        sprintf(str_ptr, "%02x", sum[i]);
                        str_ptr += 2;
                }
-               str_ptr = '\0';
+               *str_ptr = '\0';
                setenv(dest, str_output);
        } else {
                ulong addr;
@@ -311,8 +311,7 @@ int hash_lookup_algo(const char *algo_name, struct hash_algo **algop)
        return -EPROTONOSUPPORT;
 }
 
-static void show_hash(struct hash_algo *algo, ulong addr, ulong len,
-                     u8 *output)
+void hash_show(struct hash_algo *algo, ulong addr, ulong len, u8 *output)
 {
        int i;
 
@@ -392,7 +391,7 @@ int hash_command(const char *algo_name, int flags, cmd_tbl_t *cmdtp, int flag,
                        if (memcmp(output, vsum, algo->digest_size) != 0) {
                                int i;
 
-                               show_hash(algo, addr, len, output);
+                               hash_show(algo, addr, len, output);
                                printf(" != ");
                                for (i = 0; i < algo->digest_size; i++)
                                        printf("%02x", vsum[i]);
@@ -400,7 +399,7 @@ int hash_command(const char *algo_name, int flags, cmd_tbl_t *cmdtp, int flag,
                                return 1;
                        }
                } else {
-                       show_hash(algo, addr, len, output);
+                       hash_show(algo, addr, len, output);
                        printf("\n");
 
                        if (argc) {