diff options
author | drh <drh@noemail.net> | 2008-12-10 19:26:22 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2008-12-10 19:26:22 +0000 |
commit | ea6788322ed9cb2aee581ed7b2b1befaa45de723 (patch) | |
tree | 65d847abfea18be171501bb18f06fa71a44b2da2 /src/malloc.c | |
parent | b27b7f5d3b5d9d249b9abb258ac0e6cb54b78fdd (diff) | |
download | sqlite-ea6788322ed9cb2aee581ed7b2b1befaa45de723.tar.gz sqlite-ea6788322ed9cb2aee581ed7b2b1befaa45de723.zip |
Never use strlen(). Use our own internal sqlite3Strlen30() which is
guaranteed to never overflow an integer. Additional explicit casts to
avoid nuisance warning messages. (CVS 6007)
FossilOrigin-Name: c872d554930ecf221ac2be5f886d5d67bb35288c
Diffstat (limited to 'src/malloc.c')
-rw-r--r-- | src/malloc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/malloc.c b/src/malloc.c index da70da9f8..1950e048b 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -12,7 +12,7 @@ ** ** Memory allocation functions used throughout sqlite. ** -** $Id: malloc.c,v 1.49 2008/12/05 15:24:17 drh Exp $ +** $Id: malloc.c,v 1.50 2008/12/10 19:26:24 drh Exp $ */ #include "sqliteInt.h" #include <stdarg.h> @@ -724,7 +724,7 @@ char *sqlite3DbStrDup(sqlite3 *db, const char *z){ if( z==0 ){ return 0; } - n = strlen(z)+1; + n = (db ? sqlite3Strlen(db, z) : sqlite3Strlen30(z))+1; assert( (n&0x7fffffff)==n ); zNew = sqlite3DbMallocRaw(db, (int)n); if( zNew ){ |