From 14e89689d1464c09da42cb912f7c67d6c5139348 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Mon, 16 Jul 2012 14:18:24 +0000 Subject: [PATCH] Delimitando buffer com
quando forem gerados campos input para facilitar o tratamento pelo javascript android --- src/lib3270/html.c | 19 +++++++++++++++++++ src/lib3270/util.c | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/lib3270/html.c b/src/lib3270/html.c index 6986d82..b0693fe 100644 --- a/src/lib3270/html.c +++ b/src/lib3270/html.c @@ -99,6 +99,7 @@ struct html_info { int szText; + int form; enum mode { @@ -182,6 +183,8 @@ { char name[30]; + info->form = 1; + snprintf(name,29,"F%04d",addr); append_string(info,""; + static const char * suffix = ""; + char *text = info.text; + + info.text = lib3270_malloc(strlen(prefix)+strlen(suffix)+strlen(text)+4); + + strcpy(info.text,prefix); + strcat(info.text,text); + strcat(info.text,suffix); + + lib3270_free(text); + } + return lib3270_realloc(info.text,strlen(info.text)+2); } diff --git a/src/lib3270/util.c b/src/lib3270/util.c index b0ffdf4..f992cac 100644 --- a/src/lib3270/util.c +++ b/src/lib3270/util.c @@ -179,7 +179,7 @@ char * lib3270_vsprintf(const char *fmt, va_list args) char buf[16384]; int nc; - nc = vsprintf(buf, fmt, args); + nc = vsnprintf(buf, sizeof(buf), fmt, args); if (nc > sizeof(buf)) Error(NULL,"Internal buffer overflow"); r = lib3270_malloc(nc + 1); -- libgit2 0.21.2