+2006-12-16
+ * fixed nasty string overflow bug when entering too long envelope text
+
2006-12-05
* added feedback sounds for menu navigation "menu.item.activating" and
"menu.item.selecting" (for highlighting and executing menu entries)
-#define COMPILE_DATE_STRING "[2006-12-06 01:13]"
+#define COMPILE_DATE_STRING "[2006-12-16 14:05]"
{
int type_id = gi->custom_type_id;
+#if 1
+ strncpy(textarea_info[type_id].value, gi->textarea.value,
+ MAX_ENVELOPE_TEXT_LEN);
+ textarea_info[type_id].value[MAX_ENVELOPE_TEXT_LEN] = '\0';
+#else
+ /* !!! BUGGY !!! MAX_ENVELOPE_TEXT_LEN != MAX_GADGET_TEXTSIZE !!! */
strcpy(textarea_info[type_id].value, gi->textarea.value);
+#endif
level.changed = TRUE;
}
case GDI_INFO_TEXT:
{
- int max_textsize = MAX_INFO_TEXTSIZE - 1;
+ int max_textsize = MAX_INFO_TEXTSIZE;
char *text = va_arg(ap, char *);
if (text != NULL)
int max_textsize = MAX_GADGET_TEXTSIZE;
if (gi->textinput.size)
- max_textsize = MIN(gi->textinput.size, MAX_GADGET_TEXTSIZE - 1);
+ max_textsize = MIN(gi->textinput.size, MAX_GADGET_TEXTSIZE);
strncpy(gi->textinput.value, va_arg(ap, char *), max_textsize);
strcpy(gi->textinput.last_value, gi->textinput.value);
case GDI_TEXT_SIZE:
{
int tag_value = va_arg(ap, int);
- int max_textsize = MIN(tag_value, MAX_GADGET_TEXTSIZE - 1);
+ int max_textsize = MIN(tag_value, MAX_GADGET_TEXTSIZE);
gi->textinput.size = max_textsize;
gi->textinput.value[max_textsize] = '\0';
static void insertCharIntoTextArea(struct GadgetInfo *gi, char c)
{
- char text[MAX_GADGET_TEXTSIZE];
+ char text[MAX_GADGET_TEXTSIZE + 1];
int cursor_position = gi->textarea.cursor_position;
- if (strlen(gi->textarea.value) == MAX_GADGET_TEXTSIZE) /* no space left */
+ if (strlen(gi->textarea.value) >= MAX_GADGET_TEXTSIZE) /* no space left */
return;
strcpy(text, gi->textarea.value);
}
else if (gi->type & GD_TYPE_TEXT_INPUT) /* only valid for text input */
{
- char text[MAX_GADGET_TEXTSIZE];
+ char text[MAX_GADGET_TEXTSIZE + 1];
int text_length = strlen(gi->textinput.value);
int cursor_pos = gi->textinput.cursor_position;
char letter = getCharFromKey(key);
}
else if (gi->type & GD_TYPE_TEXT_AREA) /* only valid for text area */
{
- char text[MAX_GADGET_TEXTSIZE];
+ char text[MAX_GADGET_TEXTSIZE + 1];
int text_length = strlen(gi->textarea.value);
int area_ysize = gi->textarea.ysize;
int cursor_x_pref = gi->textarea.cursor_x_preferred;
struct GadgetTextButton
{
- char value[MAX_GADGET_TEXTSIZE]; /* text written on the button */
+ char value[MAX_GADGET_TEXTSIZE + 1]; /* text written on the button */
int size; /* maximal size of button text */
};
struct GadgetTextInput
{
- char value[MAX_GADGET_TEXTSIZE]; /* text string in input field */
- char last_value[MAX_GADGET_TEXTSIZE]; /* last text string in input field */
+ char value[MAX_GADGET_TEXTSIZE + 1]; /* text string in input field */
+ char last_value[MAX_GADGET_TEXTSIZE + 1];/* last text string in input field */
int cursor_position; /* actual text cursor position */
int number_value; /* integer value, if numeric */
int number_min; /* minimal allowed numeric value */
struct GadgetTextArea
{
- char value[MAX_GADGET_TEXTSIZE]; /* text string in input field */
- char last_value[MAX_GADGET_TEXTSIZE]; /* last text string in input field */
+ char value[MAX_GADGET_TEXTSIZE + 1]; /* text string in input field */
+ char last_value[MAX_GADGET_TEXTSIZE + 1];/* last text string in input field */
int cursor_position; /* actual text cursor position */
int cursor_x; /* actual x cursor position */
int cursor_y; /* actual y cursor position */
int id; /* internal gadget identifier */
int custom_id; /* custom gadget identifier */
int custom_type_id; /* custom gadget type identifier */
- char info_text[MAX_INFO_TEXTSIZE]; /* short popup info text */
+ char info_text[MAX_INFO_TEXTSIZE + 1];/* short popup info text */
int x, y; /* gadget position */
int width, height; /* gadget size */
unsigned int type; /* type (button, text input, ...) */