diff options
author | Marcus Boerger <helly@php.net> | 2007-02-24 02:17:47 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2007-02-24 02:17:47 +0000 |
commit | 50ea26760da4e0fcf4980e739e1d0ed520de8d59 (patch) | |
tree | 888a32ce58864f5318a7f1072f8526c6a99212f9 /ext/interbase/ibase_blobs.c | |
parent | 3e262bd36989898ac01224f0a987e79f44d25b31 (diff) | |
download | php-git-50ea26760da4e0fcf4980e739e1d0ed520de8d59.tar.gz |
- Avoid sprintf, even when checked copy'n'paste or changes lead to errors
Diffstat (limited to 'ext/interbase/ibase_blobs.c')
-rw-r--r-- | ext/interbase/ibase_blobs.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/ext/interbase/ibase_blobs.c b/ext/interbase/ibase_blobs.c index d622359c9d..4625281a11 100644 --- a/ext/interbase/ibase_blobs.c +++ b/ext/interbase/ibase_blobs.c @@ -74,16 +74,15 @@ int _php_ibase_string_to_quad(char const *id, ISC_QUAD *qd) /* {{{ */ char *_php_ibase_quad_to_string(ISC_QUAD const qd) /* {{{ */ { - char *result = (char *) emalloc(BLOB_ID_LEN+1); + char *result; /* shortcut for most common case */ if (sizeof(ISC_QUAD) == sizeof(ISC_UINT64)) { - sprintf(result, "0x%0*" LL_MASK "x", 16, *(ISC_UINT64*)(void *) &qd); + spprintf(&result, BLOB_ID_LEN+1, "0x%0*" LL_MASK "x", 16, *(ISC_UINT64*)(void *) &qd); } else { ISC_UINT64 res = ((ISC_UINT64) qd.gds_quad_high << 0x20) | qd.gds_quad_low; - sprintf(result, "0x%0*" LL_MASK "x", 16, res); + spprintf(&result, BLOB_ID_LEN+1, "0x%0*" LL_MASK "x", 16, res); } - result[BLOB_ID_LEN] = '\0'; return result; } /* }}} */ |