|
26 | 26 | #include "ds3_request.h" |
27 | 27 | #include "ds3_net.h" |
28 | 28 |
|
29 | | -//The max size of an uint32_t should be 10 characters + NULL |
30 | | -static const char UNSIGNED_LONG_BASE_10[] = "4294967296"; |
31 | | -static const unsigned int UNSIGNED_LONG_BASE_10_STR_LEN = sizeof(UNSIGNED_LONG_BASE_10) + 1; |
32 | | -//The max size of an uint64_t should be 20 characters + NULL |
33 | | -static const char UNSIGNED_LONG_LONG_BASE_10[] = "18446744073709551615"; |
34 | | -static const unsigned int UNSIGNED_LONG_LONG_BASE_10_STR_LEN = sizeof(UNSIGNED_LONG_LONG_BASE_10) + 1; |
| 29 | +static const unsigned int STRING_BUFFER_SIZE = 32; |
35 | 30 |
|
36 | 31 | static char* _get_ds3_bucket_acl_permission_str(ds3_bucket_acl_permission input) { |
37 | 32 | if (input == DS3_BUCKET_ACL_PERMISSION_LIST) { |
@@ -857,21 +852,21 @@ static void _set_query_param_flag(const ds3_request* _request, const char* key, |
857 | 852 | } |
858 | 853 |
|
859 | 854 | static void _set_query_param_uint64_t(const ds3_request* _request, const char* key, uint64_t value) { |
860 | | - char string_buffer[UNSIGNED_LONG_LONG_BASE_10_STR_LEN]; |
| 855 | + char string_buffer[STRING_BUFFER_SIZE]; |
861 | 856 | memset(string_buffer, 0, sizeof(string_buffer)); |
862 | 857 | snprintf(string_buffer, sizeof(string_buffer), "%" PRIu64, value); |
863 | 858 | _set_query_param(_request, key, string_buffer); |
864 | 859 | } |
865 | 860 |
|
866 | 861 | static void _set_query_param_int(const ds3_request* _request, const char* key, int value) { |
867 | | - char string_buffer[UNSIGNED_LONG_BASE_10_STR_LEN]; |
| 862 | + char string_buffer[STRING_BUFFER_SIZE]; |
868 | 863 | memset(string_buffer, 0, sizeof(string_buffer)); |
869 | 864 | snprintf(string_buffer, sizeof(string_buffer), "%d", value); |
870 | 865 | _set_query_param(_request, key, string_buffer); |
871 | 866 | } |
872 | 867 |
|
873 | 868 | static void _set_query_param_float(const ds3_request* _request, const char* key, float value) { |
874 | | - char string_buffer[UNSIGNED_LONG_BASE_10_STR_LEN]; |
| 869 | + char string_buffer[STRING_BUFFER_SIZE]; |
875 | 870 | memset(string_buffer, 0, sizeof(string_buffer)); |
876 | 871 | snprintf(string_buffer, sizeof(string_buffer), "%f", value); |
877 | 872 | _set_query_param(_request, key, string_buffer); |
|
0 commit comments