@@ -146,7 +146,7 @@ zp_keyexpr_canon_status_t __zp_canon_prefix(const char *start, size_t *len) {
146146 char const * next_slash ;
147147
148148 do {
149- next_slash = strchr (chunk_start , '/' );
149+ next_slash = memchr (chunk_start , '/' , _z_ptr_char_diff ( end , chunk_start ) );
150150 const char * chunk_end = next_slash ? next_slash : end ;
151151 size_t chunk_len = _z_ptr_char_diff (chunk_end , chunk_start );
152152 switch (chunk_len ) {
@@ -291,7 +291,7 @@ void __zp_ke_write_chunk(char **writer, const char *chunk, size_t len, const cha
291291 writer [0 ] = _z_ptr_char_offset (writer [0 ], 1 );
292292 }
293293
294- (void )memcpy (writer [0 ], chunk , len );
294+ (void )memmove (writer [0 ], chunk , len );
295295 writer [0 ] = _z_ptr_char_offset (writer [0 ], (ptrdiff_t )len );
296296}
297297
@@ -766,10 +766,9 @@ zp_keyexpr_canon_status_t _z_keyexpr_canonize(char *start, size_t *len) {
766766 } else {
767767 assert (false); // anything before "$*" or "**" must be part of the canon prefix
768768 }
769-
770769 while (next_slash != NULL ) {
771770 reader = _z_ptr_char_offset (next_slash , 1 );
772- next_slash = strchr (reader , '/' );
771+ next_slash = memchr (reader , '/' , _z_ptr_char_diff ( end , reader ) );
773772 chunk_end = next_slash ? next_slash : end ;
774773 switch (_z_ptr_char_diff (chunk_end , reader )) {
775774 case 0 : {
0 commit comments