* user.c (check_format_var): Use more suitable function
g_strndup, instead sequence g_malloc(), strncpy(), name[len] = '\0' * man2hlp.c (handle_link): Use g_strlcpy instead sequence strncpy(), name[len] = '\0' * profile.c (GetSetProfile): Likewise. * wtools.c (fg_input_dialog_help): Likewise.
Этот коммит содержится в:
родитель
03ddc6c8e9
Коммит
de59cf86c4
@ -1,3 +1,14 @@
|
|||||||
|
2004-09-01 Pavel S. Shirshov <pavelsh@mail.ru>
|
||||||
|
|
||||||
|
* user.c (check_format_var): Use more suitable function
|
||||||
|
g_strndup, instead sequence g_malloc(), strncpy(), name[len] = '\0'
|
||||||
|
* man2hlp.c (handle_link): Use g_strlcpy instead sequence
|
||||||
|
strncpy(), name[len] = '\0'
|
||||||
|
* profile.c (GetSetProfile): Likewise.
|
||||||
|
* wtools.c (fg_input_dialog_help): Likewise.
|
||||||
|
|
||||||
|
Based on patch from Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
2004-09-01 Andrew V. Samoilov <sav@bcs.zp.ua>
|
2004-09-01 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||||
|
|
||||||
* wtools.h: Fix warnings.
|
* wtools.h: Fix warnings.
|
||||||
|
@ -611,8 +611,7 @@ handle_link (char *buffer)
|
|||||||
/* Bold text or italics text */
|
/* Bold text or italics text */
|
||||||
if (buffer[0] == '.' && (buffer[1] == 'I' || buffer[1] == 'B'))
|
if (buffer[0] == '.' && (buffer[1] == 'I' || buffer[1] == 'B'))
|
||||||
for (buffer += 2; *buffer == ' ' || *buffer == '\t'; buffer++);
|
for (buffer += 2; *buffer == ' ' || *buffer == '\t'; buffer++);
|
||||||
strncpy (old, buffer, sizeof (old) - 1);
|
g_strlcpy (old, buffer, sizeof (old));
|
||||||
old[sizeof (old) - 1] = 0;
|
|
||||||
link_flag = 3;
|
link_flag = 3;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -327,10 +327,9 @@ static short GetSetProfile (int set, const char * AppName, const char * KeyName,
|
|||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
s = GetSetProfileChar (set, AppName, KeyName, Default, FileName);
|
s = GetSetProfileChar (set, AppName, KeyName, Default, FileName);
|
||||||
if (!set){
|
if (!set)
|
||||||
ReturnedString [Size-1] = 0;
|
g_strlcpy (ReturnedString, s, Size);
|
||||||
g_strlcpy (ReturnedString, s, Size-1);
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,9 +137,7 @@ int check_format_var (const char *p, char **v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the variable name */
|
/* Copy the variable name */
|
||||||
var_name = g_malloc (dots - p);
|
var_name = g_strndup (p + 4, dots-2 - (p+3));
|
||||||
strncpy (var_name, p+4, dots-2 - (p+3));
|
|
||||||
var_name [dots-2 - (p+3)] = 0;
|
|
||||||
|
|
||||||
value = getenv (var_name);
|
value = getenv (var_name);
|
||||||
g_free (var_name);
|
g_free (var_name);
|
||||||
@ -147,9 +145,7 @@ int check_format_var (const char *p, char **v)
|
|||||||
*v = g_strdup (value);
|
*v = g_strdup (value);
|
||||||
return q-p;
|
return q-p;
|
||||||
}
|
}
|
||||||
var_name = g_malloc (q - dots + 1);
|
var_name = g_strndup (dots, q - dots);
|
||||||
strncpy (var_name, dots, q - dots + 1);
|
|
||||||
var_name [q-dots] = 0;
|
|
||||||
*v = var_name;
|
*v = var_name;
|
||||||
return q-p;
|
return q-p;
|
||||||
}
|
}
|
||||||
|
@ -453,8 +453,7 @@ fg_input_dialog_help (const char *header, const char *text, const char *help,
|
|||||||
|
|
||||||
/* we need a unique name for histname because widget.c:history_tool()
|
/* we need a unique name for histname because widget.c:history_tool()
|
||||||
needs a unique name for each dialog - using the header is ideal */
|
needs a unique name for each dialog - using the header is ideal */
|
||||||
strncpy (histname + 3, header, 60);
|
g_strlcpy (histname + 3, header, 61);
|
||||||
histname[63] = '\0';
|
|
||||||
quick_widgets[2].histname = histname;
|
quick_widgets[2].histname = histname;
|
||||||
|
|
||||||
len = max ((int) strlen (header), msglen (text, &lines)) + 4;
|
len = max ((int) strlen (header), msglen (text, &lines)) + 4;
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user