Browse Source

Fix strstr call on base64

tags/1.9.4
falkTX 12 years ago
parent
commit
b555400791
2 changed files with 3 additions and 4 deletions
  1. +1
    -0
      source/tests/Makefile
  2. +2
    -4
      source/utils/CarlaBase64Utils.hpp

+ 1
- 0
source/tests/Makefile View File

@@ -9,6 +9,7 @@ include ../Makefile.mk
# --------------------------------------------------------------

BUILD_CXX_FLAGS += -I../backend -I../includes -I../utils -Wall -Wextra
# BUILD_CXX_FLAGS += -D_FORTIFY_SOURCE=2 -fstack-protector
# BUILD_CXX_FLAGS += -I/opt/mingw32/include

ANSI_CXX_FLAGS = -ansi -pedantic -pedantic-errors -Wunused-parameter -Wuninitialized -Wno-vla


+ 2
- 4
source/utils/CarlaBase64Utils.hpp View File

@@ -110,8 +110,6 @@ void carla_base64_encode(const uint8_t* const raw, const size_t len, char* const
static inline
unsigned int carla_base64_decode(const char* const encoded, uint8_t* const raw)
{
char base64[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

const uint8_t* encodedBytes = (const uint8_t*)encoded;
uint8_t* rawBytes = (uint8_t*)raw;
uint8_t encodedByte;
@@ -149,7 +147,7 @@ unsigned int carla_base64_decode(const char* const encoded, uint8_t* const raw)
}

/* Process normal characters */
char* match = std::strchr(base64, encodedByte);
const char* match = std::strchr(kBase64, encodedByte);

if (match == nullptr)
{
@@ -157,7 +155,7 @@ unsigned int carla_base64_decode(const char* const encoded, uint8_t* const raw)
return 0;
}

int decoded = match - base64;
int decoded = match - kBase64;

/* Add to raw data */
decoded <<= 2;


Loading…
Cancel
Save