mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Try to capture some more potential buffer overflows caused by localization
A couple of these could clearly cause a crash just like the one fixed by commit 00865f5a1e1a ("equipment.c: Fix potential buffer overflow in size_data_funct()"). One would append user input to fixed length buffer without checking. We were hardcoding the (correct) max path length in macos.c - replaced by the actual OS constant. But the vast majority are just extremely generous guesses how long localized strings could possibly be. Yes, this commit is likely leaning towards overkill. But we have now been bitten by buffer overflow crashes twice that were caused by localization, so I tried to go through all of the code and identify every possible buffer that could be affected by this. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
93eeb03d67
commit
0129192958
13 changed files with 31 additions and 30 deletions
|
@ -1793,7 +1793,7 @@ static gboolean profile_tooltip (GtkWidget *widget, gint x, gint y,
|
|||
gint tx = x - drawing_area->x; /* get transformed coordinates */
|
||||
gint ty = y - drawing_area->y;
|
||||
gint width, height, time = -1;
|
||||
char buffer[256], plot[256];
|
||||
char buffer[2048], plot[1024];
|
||||
const char *event = "";
|
||||
|
||||
if (tx < 0 || ty < 0)
|
||||
|
@ -2082,7 +2082,7 @@ void set_dc_nickname(struct dive *dive)
|
|||
{
|
||||
GtkWidget *dialog, *vbox, *entry, *frame, *label;
|
||||
char nickname[160] = "";
|
||||
char dialogtext[1024];
|
||||
char dialogtext[2048];
|
||||
const char *name = nickname;
|
||||
struct divecomputer *dc = &dive->dc;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue