File tree Expand file tree Collapse file tree 1 file changed +10
-19
lines changed Expand file tree Collapse file tree 1 file changed +10
-19
lines changed Original file line number Diff line number Diff line change 22
22
* @author Christian Grothoff
23
23
*/
24
24
25
- /* needed for asprintf */
26
- #define _GNU_SOURCE
27
-
28
-
29
25
#include <stdlib.h>
30
26
#include <string.h>
31
27
#include <stdio.h>
@@ -319,13 +315,11 @@ fill_v1_form (const void *cls,
319
315
char * reply ;
320
316
struct MHD_Response * response ;
321
317
322
- if (-1 == asprintf (& reply ,
323
- form ,
324
- session -> value_1 ))
325
- {
326
- /* oops */
327
- return MHD_NO ;
328
- }
318
+ reply = malloc (strlen (form ) + strlen (session -> value_1 ) + 1 );
319
+ snprintf (reply ,
320
+ strlen (form ) + strlen (session -> value_1 ) + 1 ,
321
+ form ,
322
+ session -> value_1 );
329
323
/* return static form */
330
324
response = MHD_create_response_from_buffer (strlen (reply ),
331
325
(void * ) reply ,
@@ -361,14 +355,11 @@ fill_v1_v2_form (const void *cls,
361
355
char * reply ;
362
356
struct MHD_Response * response ;
363
357
364
- if (-1 == asprintf (& reply ,
365
- form ,
366
- session -> value_1 ,
367
- session -> value_2 ))
368
- {
369
- /* oops */
370
- return MHD_NO ;
371
- }
358
+ reply = malloc (strlen (form ) + strlen (session -> value_1 ) + strlen (session -> value_2 ) + 1 );
359
+ snprintf (reply ,
360
+ strlen (form ) + strlen (session -> value_1 ) + strlen (session -> value_2 ) + 1 ,
361
+ form ,
362
+ session -> value_1 );
372
363
/* return static form */
373
364
response = MHD_create_response_from_buffer (strlen (reply ),
374
365
(void * ) reply ,
You can’t perform that action at this time.
0 commit comments