<commit_before>
//------------------------------------------------------------------------------
// Dependencies

#include <stdio.h>   // FILE, stderr, sprintf, printf, fopen
#include <stdlib.h>  // calloc, free
#include <string.h>  // strlen, strcpy
#include <unistd.h>  // getpass
#include <time.h>    // CLOCKS_PER_SEC, clock_t, clock

#include <alias.h>   // buff_size, bool, true, false
#include <data.h>    // config, obj, layer
#include <hash.h>    // get_hash
#include <utility.h> // reverse_string, fill_key_buffer
#include <vke.h>

//------------------------------------------------------------------------------
// Initialization

/**
 * Initialize a source file and encryption keys
 */
bool initialize(config* cfg, obj* info, char* name, int indx,
    const char* access, bool force_file) {
  info->name    = name;
  info->is_file = true;

  int msec = ((clock_t)(clock() - cfg->start) * 1000 / CLOCKS_PER_SEC);
  printf("Initializing: %s [ %i ] (%dsec & %dms)\n", name, indx, msec / 1000, msec % 1000);

  if (!(info->buff = (char*) calloc(buff_size, 1))) {
    printf("Unable to buffer %s\n", info->name);
    return false;
  }
  if (!(info->data = fopen(info->name, access))) {
    if (force_file) {
      printf("Unable to open %s\n", info->name);
      free(info->buff);
      return false;
    } else {
      strcpy(info->buff, "");
      strcpy(info->buff, name);

      if (strcmp(info->buff, "prompt") == 0) {
        char pass_prompt[80];
        char pass_input[500];
        sprintf(pass_prompt, "Enter passphrase for key %i: ", indx);
        strcpy(pass_input, getpass(pass_prompt));

        char confirm_prompt[80];
        char confirm_input[500];
        sprintf(confirm_prompt, "Confirm passphrase for key %i: ", indx);
        strcpy(confirm_input, getpass(confirm_prompt));

        if (strcmp(pass_input, confirm_input) == 0) {
          info->buff = pass_input;
        } else {
          printf("Passphrase and confirmation for key %i do not match\n\n",
              indx);
          return false;
        }
      }
<commit_msg>Fixing buffer assignment issue in vke passphrase prompt.<commit_after>
//------------------------------------------------------------------------------
// Dependencies

#include <stdio.h>   // FILE, stderr, sprintf, printf, fopen
#include <stdlib.h>  // calloc, free
#include <string.h>  // strlen, strcpy
#include <unistd.h>  // getpass
#include <time.h>    // CLOCKS_PER_SEC, clock_t, clock

#include <alias.h>   // buff_size, bool, true, false
#include <data.h>    // config, obj, layer
#include <hash.h>    // get_hash
#include <utility.h> // reverse_string, fill_key_buffer
#include <vke.h>

//------------------------------------------------------------------------------
// Initialization

/**
 * Initialize a source file and encryption keys
 */
bool initialize(config* cfg, obj* info, char* name, int indx,
    const char* access, bool force_file) {
  info->name    = name;
  info->is_file = true;

  int msec = ((clock_t)(clock() - cfg->start) * 1000 / CLOCKS_PER_SEC);
  printf("Initializing: %s [ %i ] (%dsec & %dms)\n", name, indx, msec / 1000, msec % 1000);

  if (!(info->buff = (char*) calloc(buff_size, 1))) {
    printf("Unable to buffer %s\n", info->name);
    return false;
  }
  if (!(info->data = fopen(info->name, access))) {
    if (force_file) {
      printf("Unable to open %s\n", info->name);
      free(info->buff);
      return false;
    } else {
      strcpy(info->buff, "");
      strcpy(info->buff, name);

      if (strcmp(info->buff, "prompt") == 0) {
        char pass_prompt[80];
        char pass_input[500];
        sprintf(pass_prompt, "Enter passphrase for key %i: ", indx);
        strcpy(pass_input, getpass(pass_prompt));

        char confirm_prompt[80];
        char confirm_input[500];
        sprintf(confirm_prompt, "Confirm passphrase for key %i: ", indx);
        strcpy(confirm_input, getpass(confirm_prompt));

        if (strcmp(pass_input, confirm_input) == 0) {
          strcpy(info->buff, "");
          strcpy(info->buff, pass_input);
        } else {
          printf("Passphrase and confirmation for key %i do not match\n\n",
              indx);
          return false;
        }
      }

{'fraction_non_alphanumeric': 0.21998101566207878, 'fraction_numerical': 0.011865211200759373, 'mean_word_length': 2.1061164333087694, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 50, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1106891', 'n_tokens_mistral': 1382, 'n_tokens_neox': 1322, 'n_words': 342}