comparison libpurple/util.c @ 26885:8290e36a5a73

A patch from Scott Wolchok to replace snprintf() with g_snprintf() and increase the size of some buffers to be able to fit -2^63. I don't think the snprintf() -> g_snprintf() changes do anything with glibc, but there's no harm in using the glib function to guarantee NUL termination. Fixes #8974
author Richard Laager <rlaager@wiktel.com>
date Sat, 16 May 2009 19:58:40 +0000
parents ab31daf1c1ee
children 9e45d860b9af
comparison
equal deleted inserted replaced
26884:88c87a40a738 26885:8290e36a5a73
127 g_return_val_if_fail(len > 0, NULL); 127 g_return_val_if_fail(len > 0, NULL);
128 128
129 ascii = g_malloc(len * 2 + 1); 129 ascii = g_malloc(len * 2 + 1);
130 130
131 for (i = 0; i < len; i++) 131 for (i = 0; i < len; i++)
132 snprintf(&ascii[i * 2], 3, "%02hhx", data[i]); 132 g_snprintf(&ascii[i * 2], 3, "%02hhx", data[i]);
133 133
134 return ascii; 134 return ascii;
135 } 135 }
136 136
137 guchar * 137 guchar *