Skip to content

Commit

Permalink
Fix signed vs unsigned: rpmBase64Encode
Browse files Browse the repository at this point in the history
Turn linelen to unsigned internally.

Related: rpm-software-management#3226
  • Loading branch information
ffesti committed Jan 10, 2025
1 parent ccc12ea commit 0763c1d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rpmio/base64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,21 @@ static char *base64_encode_block(const char *plaintext_in, int length_in, char *

#define BASE64_DEFAULT_LINE_LENGTH 64

char *rpmBase64Encode(const void *data, size_t len, int linelen)
char *rpmBase64Encode(const void *data, size_t len, int linelen_)
{
size_t encodedlen;
const char *dataptr = (const char *)data;
char *output;
char *outptr;
size_t linelen;

if (data == NULL)
return NULL;

if (linelen < 0)
if (linelen_ < 0)
linelen = BASE64_DEFAULT_LINE_LENGTH;
else
linelen = linelen_;

linelen /= 4;
encodedlen = ((len + 2) / 3) * 4;
Expand Down

0 comments on commit 0763c1d

Please sign in to comment.