Skip to content

Commit 74454e1

Browse files
committed
fix memccpy() in tool.c, thanks khindenburg
see macports ticket 41174
1 parent f04cfc2 commit 74454e1

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
started 7.38.4 23/6/14
2+
- fix memccpy() in tool.c, thanks khindenburg
3+
14
started 7.38.3 16/5/14
25
- fix tiny timeout error
36

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Process this file with autoconf to produce a configure script.
22

3-
AC_INIT([nip2], [7.38.3])
3+
AC_INIT([nip2], [7.38.4])
44
# foreign stops complaints about a missing README (we use README.md instead)
55
# and missing INSTALL (the standard Gnu INSTALL is not very useful)
66
AM_INIT_AUTOMAKE([-Wall foreign])
@@ -16,7 +16,7 @@ dnl
1616

1717
m4_define([nip_major_version], [7])
1818
m4_define([nip_minor_version], [38])
19-
m4_define([nip_micro_version], [3])
19+
m4_define([nip_micro_version], [4])
2020
m4_define([nip_version],
2121
[nip_major_version.nip_minor_version.nip_micro_version])
2222

src/tool.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,18 +412,20 @@ toolitem_set_name( Toolitem *toolitem, PElement *root )
412412
result ) {
413413
if( class_get_member_string( root,
414414
MEMBER_LABEL, value, MAX_NAME ) ) {
415+
char *p, *q;
416+
415417
/* Save the i18n-ed version.
416418
*/
417419
IM_SETSTR( toolitem->label, _( value ) );
418420

419421
/* Strip underscores (they mark mnemonics). Can't use
420-
* strrcpy(), we have overlapping blocks.
422+
* strrcpy() or memccpy(), we have overlapping blocks.
421423
*/
422424
im_strncpy( value, toolitem->label, MAX_NAME );
423-
for( i = 0; value[i]; i++ )
424-
if( value[i] == '_' )
425-
memccpy( value + i, value + i + 1,
426-
0, MAX_NAME - i );
425+
for( p = q = value; *p; p++ )
426+
if( *p != '_' )
427+
*q++ = *p;
428+
*q = '\0';
427429
IM_SETSTR( toolitem->name, value );
428430
}
429431

0 commit comments

Comments
 (0)