File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -3674,18 +3674,23 @@ void uwsgi_write_pidfile_explicit(char *pidfile_name, pid_t pid) {
36743674}
36753675
36763676char * uwsgi_expand_path (char * dir , int dir_len , char * ptr ) {
3677- char src [PATH_MAX + 1 ];
3678- memcpy (src , dir , dir_len );
3679- src [dir_len ] = 0 ;
3677+ if (dir_len > PATH_MAX )
3678+ {
3679+ uwsgi_log ("invalid path size: %d (max %d)\n" , dir_len , PATH_MAX );
3680+ return NULL ;
3681+ }
3682+ char * src = uwsgi_concat2n (dir , dir_len , "" , 0 );
36803683 char * dst = ptr ;
36813684 if (!dst )
36823685 dst = uwsgi_malloc (PATH_MAX + 1 );
36833686 if (!realpath (src , dst )) {
36843687 uwsgi_error_realpath (src );
36853688 if (!ptr )
36863689 free (dst );
3690+ free (src );
36873691 return NULL ;
36883692 }
3693+ free (src );
36893694 return dst ;
36903695}
36913696
You can’t perform that action at this time.
0 commit comments