annotate dbmalloc.h @ 1631:292f79307600

fix some gcc warnings (#73) * tweak string size fix gcc8 warnings ``` svr-agentfwd.c: In function 'bindagent': svr-agentfwd.c:254:53: warning: '%s' directive output may be truncated writing up to 107 bytes into a region of size between 0 and 107 [-Wformat-truncation=] snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/%s", path, sockfile); ^~ ~~~~~~~~ svr-agentfwd.c:254:2: note: 'snprintf' output between 2 and 216 bytes into a destination of size 108 snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/%s", path, sockfile); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` * cleanup signed/unsigned comparison fix gcc8 warnings ``` scp.c: In function 'do_local_cmd': scp.c:132:17: warning: comparison of integer expressions of different signedness: 'u_int' {aka 'unsigned int'} and 'int' [-Wsign-compare] for (i = 0; i < a->num; i++) ^ scpmisc.c: In function 'addargs': scpmisc.c:161:25: warning: comparison of integer expressions of different signedness: 'int' and 'u_int' {aka 'unsigned int'} [-Wsign-compare] } else if (args->num+2 >= nalloc) ^~ scpmisc.c: In function 'replacearg': scpmisc.c:183:12: warning: comparison of integer expressions of different signedness: 'u_int' {aka 'unsigned int'} and 'int' [-Wsign-compare] if (which >= args->num) ^~ scpmisc.c: In function 'freeargs': scpmisc.c:196:17: warning: comparison of integer expressions of different signedness: 'u_int' {aka 'unsigned int'} and 'int' [-Wsign-compare] for (i = 0; i < args->num; i++) ^ ``` see https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/misc.h.diff?r1=1.16&r2=1.17
author François Perrad <francois.perrad@gadz.org>
date Wed, 20 Mar 2019 15:25:15 +0100
parents d4efb7801fcd
children 8dc43b30c6bf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1361
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
1 #ifndef DBMALLOC_H_
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
2 #define DBMALLOC_H_
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
3
1571
d4efb7801fcd Attempt to fix m_free for libtomcrypt/libtommath
Matt Johnston <matt@ucc.asn.au>
parents: 1569
diff changeset
4 #include "stdint.h"
d4efb7801fcd Attempt to fix m_free for libtomcrypt/libtommath
Matt Johnston <matt@ucc.asn.au>
parents: 1569
diff changeset
5 #include "stdlib.h"
d4efb7801fcd Attempt to fix m_free for libtomcrypt/libtommath
Matt Johnston <matt@ucc.asn.au>
parents: 1569
diff changeset
6 #include "options.h"
1361
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
7
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
8 void * m_malloc(size_t size);
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
9 void * m_calloc(size_t nmemb, size_t size);
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
10 void * m_strdup(const char * str);
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
11 void * m_realloc(void* ptr, size_t size);
1569
c42e8ff42bd1 Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents: 1378
diff changeset
12
c42e8ff42bd1 Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents: 1378
diff changeset
13 #if DROPBEAR_TRACKING_MALLOC
1361
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
14 void m_free_direct(void* ptr);
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
15 void m_malloc_set_epoch(unsigned int epoch);
1378
7209a6e30932 linked list dbmalloc now
Matt Johnston <matt@ucc.asn.au>
parents: 1365
diff changeset
16 void m_malloc_free_epoch(unsigned int epoch, int dofree);
1361
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
17
1569
c42e8ff42bd1 Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents: 1378
diff changeset
18 #else
c42e8ff42bd1 Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents: 1378
diff changeset
19 /* plain wrapper */
1571
d4efb7801fcd Attempt to fix m_free for libtomcrypt/libtommath
Matt Johnston <matt@ucc.asn.au>
parents: 1569
diff changeset
20 #define m_free_direct free
1569
c42e8ff42bd1 Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents: 1378
diff changeset
21
c42e8ff42bd1 Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents: 1378
diff changeset
22 #endif
c42e8ff42bd1 Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents: 1378
diff changeset
23
1571
d4efb7801fcd Attempt to fix m_free for libtomcrypt/libtommath
Matt Johnston <matt@ucc.asn.au>
parents: 1569
diff changeset
24 #define m_free(X) do {m_free_direct(X); (X) = NULL;} while (0)
d4efb7801fcd Attempt to fix m_free for libtomcrypt/libtommath
Matt Johnston <matt@ucc.asn.au>
parents: 1569
diff changeset
25
1569
c42e8ff42bd1 Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents: 1378
diff changeset
26
1361
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
27 #endif /* DBMALLOC_H_ */