File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -259,6 +259,10 @@ static int quote_fname(char *file, size_t filesize)
259259 cp = file ;
260260 dp = fbuf ;
261261
262+ /* safety check for overflow - highly unlikely! */
263+ if (strlen (file ) * 2 + 1 > sizeof (fbuf )) {
264+ return (0 );
265+ }
262266 while (* cp ) {
263267 switch (* cp ) {
264268 case '>' :
@@ -344,6 +348,10 @@ static int quote_fname_ufs(char *file, size_t filesize)
344348 cp = file ;
345349 dp = fbuf ;
346350
351+ /* safety check for overflow - highly unlikely! */
352+ if (strlen (file ) * 2 + 1 > sizeof (fbuf )) {
353+ return (0 );
354+ }
347355 while (* cp ) {
348356 switch (* cp ) {
349357 case '>' :
@@ -419,6 +427,10 @@ static int quote_dname(char *dir, size_t dirsize)
419427 cp = dir ;
420428 dp = fbuf ;
421429
430+ /* safety check for overflow - highly unlikely! */
431+ if (strlen (dir ) * 2 + 1 > sizeof (fbuf )) {
432+ return (0 );
433+ }
422434 while (* cp ) {
423435 switch (* cp ) {
424436 case '>' :
You can’t perform that action at this time.
0 commit comments