libssh2_base64_decode(3)

πŸ“¦
version 1.11.1 Β· 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, debian trixie, epel 10, epel 9, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– libssh2_base64_decode πŸ’–

okay bestie, welcome to the libssh2_base64_decode page β€” part of the libssh2 manual, third section, and honestly? this one's a ✨situationship✨ not a function. buckle up. πŸŽ€


🌸 NAME 🌸

libssh2_base64_decode β€” decode a base64 encoded string πŸ¦‹


✨ SYNOPSIS ✨

#include <libssh2.h>

int
libssh2_base64_decode(LIBSSH2_SESSION *session, char **dest,
                      unsigned int *dest_len, const char *src,
                      unsigned int src_len);

πŸ’… DESCRIPTION πŸ’…

so. okay. deep breath. 🫢

this function is deemed DEPRECATED and will be removed from libssh2 in a future version. do not use it!! 🚨

like. not "maybe don't". not "consider another option". do not use it. that's the whole vibe. πŸ’€

what it does, for the record: it decodes a base64 chunk and stores it into a newly allocated buffer. 🧚

dest_len gets set to hold the length of the returned buffer β€” and that's the buffer that *dest will point to. so like, the pointer points, the length tells you how much, cute, iconic, whatever. πŸ‘‘

and here's the part that makes me scream: the returned buffer is allocated by this function, but it is not clear how to free that memory! 😭 it's giving "here's a gift, no receipt, no box, no clue". no cap.


πŸ’€ BUGS πŸ’€

okay so the tea: πŸ“

the memory that *dest points to is allocated by the malloc function that libssh2 uses β€” but there is no way for an application to free this data in a safe and reliable way!! 😭

like. it's allocated. it's yours. you cannot safely let it go. that is the bug. that is the entire bug. fr fr. πŸ’€


🌈 RETURN VALUE 🌈

  • 0 β€” if successful ✨
  • -1 β€” if any error occurred πŸ™ˆ

πŸ‘‘ SEE ALSO πŸ‘‘

hmm, there's nothing listed here bestie β€” this page is a lone wolf, main character energy, no supporting cast. πŸ¦‹


anyway, that's the whole page β€” from the libssh2 1.0 era, dated 23 Dec 2008, which is genuinely ancient in internet years. πŸ’œ mwah, stay safe, don't call the deprecated function, and free your memory responsibly (when the docs let you) πŸŽ€βœ¨