Przeglądaj źródła

* Ensure that SHELLHASH is a 40 char sha1 digest

Bryan Drewery 17 lat temu
rodzic
commit
7cf3d23f15
1 zmienionych plików z 8 dodań i 0 usunięć
  1. 8 0
      src/binary.c

+ 8 - 0
src/binary.c

@@ -351,6 +351,14 @@ readcfg(const char *cfgfile, bool read_stdin)
         if (!egg_strcasecmp(buffer, STR("packname"))) {
           strlcpy(settings.packname, trim(p), sizeof settings.packname);
         } else if (!egg_strcasecmp(buffer, STR("shellhash"))) {
+          if (strlen(trim(p)) != 40) {
+            fprintf(stderr, STR("SHELLHASH should be a SHA1 hash.\n"));
+            error_line = (line_list_t *) my_calloc(1, sizeof(line_list_t));
+            error_line->line = line;
+            error_line->next = NULL;
+            list_append((struct list_type **) &(error_list), (struct list_type *) error_line);
+            error = 1;
+          }
           strlcpy(settings.shellhash, trim(p), sizeof settings.shellhash);
         } else if (!egg_strcasecmp(buffer, STR("dccprefix"))) {
           strlcpy(settings.dcc_prefix, trim(p), 2);