mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 05:03:25 +00:00
Make sure that the user entered nickname is never truncated
If the sizes of the two char buffers in set_dc_nickname() (nickname) and remember_dc() (buffer) are at least twice the size of the allowed maximum number of characters (sizeof(gunichar) = 2) set by gtk_entry_set_max_length() for the user nickname, no truncation will accur then calling snprintf() and cleanedup_nickname() on said buffers. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
2f9960f20b
commit
92c15238b6
1 changed files with 2 additions and 2 deletions
|
@ -2043,7 +2043,7 @@ static char *cleanedup_nickname(const char *nickname, int len)
|
|||
void remember_dc(uint32_t deviceid, const char *nickname, gboolean change_conf)
|
||||
{
|
||||
if (!get_dc_nickname(deviceid)) {
|
||||
char buffer[256];
|
||||
char buffer[160];
|
||||
struct dcnicknamelist *nn_entry = malloc(sizeof(struct dcnicknamelist));
|
||||
nn_entry->deviceid = deviceid;
|
||||
/* make sure there are no curly braces or commas in the string and that
|
||||
|
@ -2062,7 +2062,7 @@ void remember_dc(uint32_t deviceid, const char *nickname, gboolean change_conf)
|
|||
void set_dc_nickname(struct dive *dive)
|
||||
{
|
||||
GtkWidget *dialog, *vbox, *entry, *frame, *label;
|
||||
char nickname[68];
|
||||
char nickname[160];
|
||||
const char *name;
|
||||
|
||||
if (!dive)
|
||||
|
|
Loading…
Add table
Reference in a new issue