Skip to contentSkip to conversation

ELL doesn't have a fallback for rawmemchr

BUG Érico Nogueira 2 participants 2 messages Nov 30, 2020

lore
Share & tools
lore
#0 lore raw

Hi!

Building ELL 0.35 on a musl system fails, due to ell/pem.c using rawmemchr(), which is a glibc extension. Building IWD with internal ELL fails for the same reason.

I see that IWD itself has src/missing.h with a fallback, but ELL lacks that.

We are using the following patch to fix the build:

ell/pem.c +0 -0
index 790f2c2..237ae02 100644
@@ -224,7 +224,7 @@ static uint8_t *pem_load_buffer(const void *buf, size_t=
 buf_len,

=20
/* Check that each header line has a key and a colon */ while (start < end) {
- const char *lf =3D rawmemchr(start, '\n');
+ const char *lf =3D memchr(start, '\n', end - start);
const char *colon =3D memchr(start, ':', lf - start);
=20
if (!colon)

--

If ELL is willing to include a src/missing.h of their own, that would solve the issue, but avoiding rawmemchr() completely is also a possibility.

Thanks,
Érico

#1 lore raw

Hi Érico,

Quoted 5 lines · Érico Nogueira

Hi!

Building ELL 0.35 on a musl system fails, due to ell/pem.c using rawmemchr(), which is a glibc extension. Building IWD with internal ELL fails for the same reason.

Thanks for reporting this.

Quoted 3 lines

I see that IWD itself has src/missing.h with a fallback, but ELL lacks that.

I ported the rawmemchr bits in missing.h from iwd to ell in commit 3916c1cc32be205e185a8a56de5cde1b9ec60e81.

Regards,
-Denis