* 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>
|
||||
|
||||
* wtools.h: Fix warnings.
|
||||
|
@ -611,8 +611,7 @@ handle_link (char *buffer)
|
||||
/* Bold text or italics text */
|
||||
if (buffer[0] == '.' && (buffer[1] == 'I' || buffer[1] == 'B'))
|
||||
for (buffer += 2; *buffer == ' ' || *buffer == '\t'; buffer++);
|
||||
strncpy (old, buffer, sizeof (old) - 1);
|
||||
old[sizeof (old) - 1] = 0;
|
||||
g_strlcpy (old, buffer, sizeof (old));
|
||||
link_flag = 3;
|
||||
break;
|
||||
case 3:
|
||||
|
@ -327,10 +327,9 @@ static short GetSetProfile (int set, const char * AppName, const char * KeyName,
|
||||
char *s;
|
||||
|
||||
s = GetSetProfileChar (set, AppName, KeyName, Default, FileName);
|
||||
if (!set){
|
||||
ReturnedString [Size-1] = 0;
|
||||
g_strlcpy (ReturnedString, s, Size-1);
|
||||
}
|
||||
if (!set)
|
||||
g_strlcpy (ReturnedString, s, Size);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
10
src/user.c
10
src/user.c
@ -137,19 +137,15 @@ int check_format_var (const char *p, char **v)
|
||||
}
|
||||
|
||||
/* Copy the variable name */
|
||||
var_name = g_malloc (dots - p);
|
||||
strncpy (var_name, p+4, dots-2 - (p+3));
|
||||
var_name [dots-2 - (p+3)] = 0;
|
||||
var_name = g_strndup (p + 4, dots-2 - (p+3));
|
||||
|
||||
value = getenv (var_name);
|
||||
g_free (var_name);
|
||||
if (value){
|
||||
*v = g_strdup (value);
|
||||
return q-p;
|
||||
}
|
||||
var_name = g_malloc (q - dots + 1);
|
||||
strncpy (var_name, dots, q - dots + 1);
|
||||
var_name [q-dots] = 0;
|
||||
}
|
||||
var_name = g_strndup (dots, q - dots);
|
||||
*v = var_name;
|
||||
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()
|
||||
needs a unique name for each dialog - using the header is ideal */
|
||||
strncpy (histname + 3, header, 60);
|
||||
histname[63] = '\0';
|
||||
g_strlcpy (histname + 3, header, 61);
|
||||
quick_widgets[2].histname = histname;
|
||||
|
||||
len = max ((int) strlen (header), msglen (text, &lines)) + 4;
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user