From c42f23f79fe7a316b61e4a8d63e0d1b83db64d7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AB=8F=E8=A8=AA=E5=AD=90?= Date: Fri, 1 Dec 2023 13:26:30 +0900 Subject: [PATCH] =?UTF-8?q?OpenBSD=E3=81=A7=E3=81=AE=E3=82=B3=E3=83=B3?= =?UTF-8?q?=E3=83=91=E3=82=A4=E3=83=A9=E3=83=BC=E3=81=8C=E7=99=BA=E7=94=9F?= =?UTF-8?q?=E3=81=95=E3=82=8C=E3=81=9F=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +++ Makefile | 4 ++-- main.c | 2 +- showpass.c | 14 +++++++++++--- yankpass.c | 2 +- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd31986..95ca75a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 1.1.2 +* OpenBSDでのコンパイラーが発生された問題を修正した + # 1.1.1 * make install-zsh部分を修正 diff --git a/Makefile b/Makefile index 3d22c6c..6dd257c 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ NAME=sp -VERSION=1.1.1 +VERSION=1.1.2 # Linux、Haiku、かIllumos = /usr、FreeBSDかOpenBSD = /usr/local、NetBSD = /usr/pkg PREFIX=/usr CC=cc FILES=main.c showpass.c yankpass.c addpass.c delpass.c listpass.c genpass.c initpass.c otppass.c -CFLAGS=-Wall -Wextra -g +CFLAGS=-Wall -Wextra -g -I${PREFIX}/include -L${PREFIX}/lib LDFLAGS=-lgpgme -lcrypto all: diff --git a/main.c b/main.c index 89d5e7e..5502a0d 100644 --- a/main.c +++ b/main.c @@ -16,7 +16,7 @@ void helpme(); const char* sofname = "sp"; -const char* version = "1.1.1"; +const char* version = "1.1.2"; void helpme() { printf("076 sp - シンプルなパスワードマネージャー\n"); diff --git a/showpass.c b/showpass.c index 76e0007..9355521 100644 --- a/showpass.c +++ b/showpass.c @@ -18,7 +18,7 @@ void clean_up(gpgme_ctx_t ctx, gpgme_data_t in, gpgme_data_t out, FILE* gpgfile, void showpass(char* file) { gpgme_ctx_t ctx; gpgme_error_t err; - gpgme_data_t in, out; + gpgme_data_t in = NULL, out = NULL; FILE *gpgfile; // GPGMEライブラリを設置 @@ -52,7 +52,7 @@ void showpass(char* file) { return; } - sprintf(gpgpath, "%s%s%s%s", homedir, basedir, file, ext); + snprintf(gpgpath, alllen, "%s%s%s%s", homedir, basedir, file, ext); gpgfile = fopen(gpgpath, "rb"); if (gpgfile == NULL) { perror("ファイルを開くに失敗。"); @@ -61,7 +61,15 @@ void showpass(char* file) { return; } - if (gpgme_data_new_from_stream(&in, gpgfile) != GPG_ERR_NO_ERROR || gpgme_data_new(&out) != GPG_ERR_NO_ERROR) { + // ファイルからinデータオブジェクトを創作 + if (gpgme_data_new_from_stream(&in, gpgfile) != GPG_ERR_NO_ERROR) { + fprintf(stderr, "GPGMEデータオブジェクトを創作に失敗。\n"); + clean_up(ctx, in, out, gpgfile, gpgpath); + return; + } + + // outデータオブジェクトを創作 + if (gpgme_data_new(&out) != GPG_ERR_NO_ERROR) { fprintf(stderr, "GPGMEデータオブジェクトを創作に失敗。\n"); clean_up(ctx, in, out, gpgfile, gpgpath); return; diff --git a/yankpass.c b/yankpass.c index b8df4de..cf0af8c 100644 --- a/yankpass.c +++ b/yankpass.c @@ -52,7 +52,7 @@ void yankpass(char* file) { return; } - sprintf(gpgpath, "%s%s%s%s", homedir, basedir, file, ext); + snprintf(gpgpath, alllen, "%s%s%s%s", homedir, basedir, file, ext); gpgfile = fopen(gpgpath, "rb"); if (gpgfile == NULL) { perror("ファイルを開くに失敗。");