From a69ec7261551fa2e52900442c06473ea500c606d Mon Sep 17 00:00:00 2001 From: "j.r" Date: Thu, 24 Mar 2022 14:17:17 +0100 Subject: [PATCH] Remove dependency on strndupa Actually only glibc seems to implement this --- src/mode/pgp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mode/pgp.c b/src/mode/pgp.c index 26ac252..d3f9a82 100644 --- a/src/mode/pgp.c +++ b/src/mode/pgp.c @@ -175,7 +175,9 @@ char* _pgp_encrypt_message(xmppc_t *xmppc, char* recipient, char* message) { } static char* _pgp_remove_PGP_MESSAGE_comment(const char* message) { - char* tmp = strndupa(message, strlen(message) - (strlen(PGP_END)+1)); + char* tmp = alloca((strlen(message) - strlen(PGP_END)) + 1); + strncpy(tmp, message, strlen(message) - strlen(PGP_END)); + tmp[(strlen(message) - strlen(PGP_END)+1)] = '\0'; tmp = tmp+((strlen(PGP_BEGIN) +1) * sizeof(char)); char* result = malloc(strlen(tmp)+1); strcpy(result, tmp);