X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=hivex%2Fhivexsh.c;h=332b77391aceddd2cc94255722a970b1e1c2f5e5;hb=4615036b31c37b78187e3368da4c673817542d9b;hp=9c54536afcc742bdcf162949a2aedde0d6d3baf3;hpb=cae0d4d698bb79f3088b256b52ee99cb4637d615;p=hivex.git diff --git a/hivex/hivexsh.c b/hivex/hivexsh.c index 9c54536..332b773 100644 --- a/hivex/hivexsh.c +++ b/hivex/hivexsh.c @@ -58,6 +58,8 @@ #include "hivex.h" #include "byte_conversions.h" +#define HIVEX_MAX_VALUES 1000 + static int quit = 0; static int is_tty; static hive_h *h = NULL; @@ -182,7 +184,6 @@ main (int argc, char *argv[]) char *cmd = buf; char *args; - size_t i = 0; if (buf[len] == '\0') { /* This is mostly safe. Although the cmd_* functions do sometimes @@ -799,7 +800,8 @@ cmd_lsval (char *key) case hive_t_full_resource_description: case hive_t_resource_requirements_list: default: { - char *data = hivex_value_value (h, values[i], &t, &len); + unsigned char *data = + (unsigned char *) hivex_value_value (h, values[i], &t, &len); if (!data) goto error; @@ -840,7 +842,7 @@ cmd_setval (char *nrvals_str) "setval", "nrvals", "xstrtol", xerr); return -1; } - if (nrvals < 0 || nrvals > 1000) { + if (nrvals < 0 || nrvals > HIVEX_MAX_VALUES) { fprintf (stderr, _("%s: %s: integer out of range\n"), "setval", "nrvals"); return -1; @@ -858,7 +860,6 @@ cmd_setval (char *nrvals_str) /* Read nrvals * 2 lines of input, nrvals * (key, value) pairs, as * explained in the man page. */ - int prompt = isatty (0) ? 2 : 0; int i, j; for (i = 0; i < nrvals; ++i) { /* Read key. */ @@ -912,7 +913,7 @@ cmd_setval (char *nrvals_str) } else if (STRPREFIX (buf, "expandstring:")) { buf += 13; - values[i].t = hive_t_string; + values[i].t = hive_t_expand_string; int nr_chars = strlen (buf); values[i].len = 2 * (nr_chars + 1); values[i].value = malloc (values[i].len);