File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -665,13 +665,13 @@ const char *suggest_doc_links(const char *progname, const char *progconf) {
665
665
buf [0 ] = '\0' ;
666
666
667
667
if (progname ) {
668
- char * s = NULL , buf2 [ LARGEBUF ] ;
669
- size_t i , max = sizeof ( buf2 ) - 1 ;
668
+ char * s = NULL , * buf2 = xstrdup ( xbasename ( progname )) ;
669
+ size_t i ;
670
670
671
- for (i = 0 ; progname [i ] && i < max ; i ++ ) {
672
- buf2 [i ] = tolower (progname [i ]);
671
+ for (i = 0 ; buf2 [i ]; i ++ ) {
672
+ buf2 [i ] = tolower (buf2 [i ]);
673
673
}
674
- buf2 [ i ] = '\0' ;
674
+
675
675
if ((s = strstr (buf2 , ".exe" )) && strcmp (buf2 , "nut.exe" ))
676
676
* s = '\0' ;
677
677
@@ -685,6 +685,8 @@ const char *suggest_doc_links(const char *progname, const char *progconf) {
685
685
snprintfcat (buf , sizeof (buf ),
686
686
"see\n\t%s/docs/man/%s.html\n" ,
687
687
NUT_WEBSITE_BASE , buf2 );
688
+
689
+ free (buf2 );
688
690
}
689
691
690
692
if (progconf )
You can’t perform that action at this time.
0 commit comments