1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

trac 29 eliminate snprintf again

Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
Andy Green 2013-04-30 06:51:10 +08:00
parent 4e414e65bb
commit d91561c2f6

View file

@ -123,11 +123,13 @@ static int callback_http(struct libwebsocket_context *context,
char client_ip[128];
#endif
char buf[256];
char leaf_path[1024];
int n, m;
unsigned char *p;
static unsigned char buffer[4096];
struct stat stat_buf;
struct per_session_data__http *pss = (struct per_session_data__http *)user;
struct per_session_data__http *pss =
(struct per_session_data__http *)user;
#ifdef EXTERNAL_POLL
int fd = (int)(long)in;
#endif
@ -138,8 +140,9 @@ static int callback_http(struct libwebsocket_context *context,
/* check for the "send a big file by hand" example case */
if (!strcmp((const char *)in, "/leaf.jpg")) {
char leaf_path[1024];
snprintf(leaf_path, sizeof(leaf_path), "%s/leaf.jpg", resource_path);
if (strlen(resource_path) > sizeof(leaf_path) - 10)
return -1;
sprintf(leaf_path, "%s/leaf.jpg", resource_path);
/* well, let's demonstrate how to send the hard way */