From 0cc9c5b1ecbfceb6473d3ae5b243d6ea13d5cdc4 Mon Sep 17 00:00:00 2001 From: leitner Date: Fri, 2 Feb 2024 10:54:25 +0000 Subject: [PATCH] don't build strstorage and strduptab (tinyldap doesn't use it anymore) add comments in strstorage.c and strduptab.c that they are obsolete --- Makefile | 4 ++-- strduptab.c | 8 ++++++-- strstorage.c | 3 +++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index a981c1c..e3dc155 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ #DEBUG=1 #COVERAGE=1 -all: libowfat-warning t1 t2 parse dumpidx idx2ldif addindex bindrequest tinyldap \ +all: libowfat-warning t2 parse dumpidx idx2ldif addindex bindrequest tinyldap \ tinyldap_standalone tinyldap_debug ldapclient ldapclient_str \ md5password mysql2ldif acl dumpacls ldapdelete asn1dump tls.a x # t6 # t @@ -36,7 +36,7 @@ scan_ldapmessage_nolengthcheck.o ldif.a: ldif_parse.o ldap_match_mapped.o -storage.a: strstorage.o strduptab.o mstorage_add.o mduptab_add.o \ +storage.a: mstorage_add.o mduptab_add.o \ bstr_diff.o mduptab_adds.o bstr_diff2.o mstorage_add_bin.o \ mstorage_init.o mstorage_init_persistent.o mstorage_unmap.o \ mduptab_init.o mduptab_init_reuse.o mduptab_reset.o diff --git a/strduptab.c b/strduptab.c index bc9a3a7..046df7b 100644 --- a/strduptab.c +++ b/strduptab.c @@ -1,3 +1,6 @@ +/* This is no longer used in tinyldap (see mduptab.h). + * The sources are here for historic reference. */ + #include #include #include "strduptab.h" @@ -13,9 +16,10 @@ const char* strduptab_add(struct stringduptable* t,const char* s) { return t->s[i]; if (t->n>=t->a) { const char** x; - int a=t->a*2; + size_t a=t->a*2; // this can not overflow + // t->s is t->a*sizeof(char*), which is always at least *2 if (!a) a=1024; - if (!(x=realloc((char**)t->s,a*sizeof(char*)))) + if (!(x=reallocarray((char**)t->s,a,sizeof(char*)))) return 0; t->a=a; t->s=x; diff --git a/strstorage.c b/strstorage.c index ea29499..c39e1b5 100644 --- a/strstorage.c +++ b/strstorage.c @@ -1,3 +1,6 @@ +/* This is no longer used in tinyldap (see mstorage.h) + * The sources are here for historic reference. */ + #include #include #include "strstorage.h"