Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile on BSD and use snprintf(). #3

Merged
merged 4 commits into from
Nov 10, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/buffer_writer.c
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

#include <assert.h>
#include <string.h>
#include <arpa/inet.h> /* FIXME: configure: Might want netinet/in.h instead. */
#include <arpa/inet.h>

#include "buffer_writer.h"
#include "memory.h"
10 changes: 6 additions & 4 deletions src/openssh.c
Original file line number Diff line number Diff line change
@@ -23,8 +23,9 @@ static bool openssh_write_public(const char *output_directory, const char *usern

if (output_directory != NULL)
{
public_file_path = malloc(strlen(output_directory) + 16);
sprintf(public_file_path, "%s/id_ed25519.pub", output_directory);
size_t public_file_path_len = strlen(output_directory) + 16;
public_file_path = malloc(public_file_path_len);
snprintf(public_file_path, public_file_path_len, "%s/id_ed25519.pub", output_directory);
}
else
public_file_path = strdup("id_ed25519.pub");
@@ -80,8 +81,9 @@ static bool openssh_write_secret(const char *output_directory, const char *usern

if (output_directory != NULL)
{
secret_file_path = malloc(strlen(output_directory) + 12);
sprintf(secret_file_path, "%s/id_ed25519", output_directory);
size_t secret_file_path_len = strlen(output_directory) + 12;
secret_file_path = malloc(secret_file_path_len);
snprintf(secret_file_path, secret_file_path_len, "%s/id_ed25519", output_directory);
}
else
secret_file_path = strdup("id_ed25519");
1 change: 1 addition & 0 deletions src/readpassphrase.h
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@
#define _READPASSPHRASE_H_

#ifndef HAVE_READPASSPHRASE
#include <stddef.h>

#define RPP_ECHO_OFF 0x00 /* Turn off echo (default). */
#define RPP_ECHO_ON 0x01 /* Leave echo on. */