Commit 0627abcd authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

- Don't nul-terminate after snprintf(), it does it already

- Use strlcpy()
parent 388d2d1b
...@@ -725,9 +725,8 @@ void E_(MacroDo)( httpd_file_sys_t *p_args, ...@@ -725,9 +725,8 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
psz = config_GetPsz( p_intf, m->param1 ); psz = config_GetPsz( p_intf, m->param1 );
if( psz != NULL ) if( psz != NULL )
{ {
strncpy( value, psz,sizeof( value ) ); strlcpy( value, psz,sizeof( value ) );
free( psz ); free( psz );
value[sizeof( value ) - 1] = '\0';
} }
else else
*value = '\0'; *value = '\0';
...@@ -736,7 +735,6 @@ void E_(MacroDo)( httpd_file_sys_t *p_args, ...@@ -736,7 +735,6 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
default: default:
snprintf( value, sizeof( value ), snprintf( value, sizeof( value ),
"invalid type(%s) in set", m->param2 ); "invalid type(%s) in set", m->param2 );
value[sizeof( value ) - 1] = '\0';
break; break;
} }
PRINTS( "%s", value ); PRINTS( "%s", value );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment