Skip to content

Commit 6494bc3

Browse files
committed
restart work on the query, fix tests
1 parent f436a4c commit 6494bc3

3 files changed

Lines changed: 7 additions & 12 deletions

File tree

cpp/test/include/libc/stdlib.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
extern "C" {
88
#endif
99

10+
extern void *reallocf(void *, unsigned long);
11+
1012
int rand(void) {
1113
return 42;
1214
}
@@ -32,4 +34,4 @@ void *malloc(unsigned long);
3234

3335
#include <stdlib.h>
3436

35-
#endif // --- end USE_HEADERS
37+
#endif // --- end USE_HEADERS

cpp/test/include/libc/string_stubs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ extern "C" {
1212
#endif
1313

1414
typedef int wchar_t;
15+
extern void *memcpy(void *dst, const void *src, unsigned long n);
1516
extern char* strcpy_s(char* dst, int max_amount, char* src);
1617
extern int _mbsncat(char* dst, char* src, int count);
1718
extern int _mbsncmp(char* dst, char* src, int count);
@@ -50,4 +51,4 @@ extern void closelog(void);
5051
#define _mbsnbcmp memcmp
5152
#define mempcpy memcpy
5253

53-
#endif
54+
#endif

cpp/test/query-tests/security/DecOverflowWhenComparing/DecOverflowWhenComparing.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
#include "../../../include/libc/unistd.h"
44
#include "../../../include/libc/stdint.h"
55

6-
// #include <stdio.h>
7-
// #include <stdint.h>
8-
// #include <stdlib.h>
9-
// #include <string.h>
10-
11-
126
// from https://github.com/apple-oss-distributions/Libinfo/blob/9fce29e5c5edc15d3ecea55116ca17d3f6350603/lookup.subproj/mdns_module.c#L1033C1-L1079C2
137
char* _mdns_parse_domain_name(const uint8_t *data, uint32_t datalen)
148
{
@@ -59,9 +53,7 @@ char* _mdns_parse_domain_name(const uint8_t *data, uint32_t datalen)
5953
}
6054

6155
int main() {
62-
const uint16_t datalen = 128;
63-
uint8_t data[datalen] = {};
56+
uint8_t data[128] = {0};
6457
memcpy(data, "\x04quildu\x03xyz\x00", 11);
65-
_mdns_parse_domain_name(data, datalen);
58+
_mdns_parse_domain_name(data, 128);
6659
}
67-

0 commit comments

Comments
 (0)