RhostMUSH / trunk

RhostMUSH 4.0: This is the official main repository of RhostMUSH. Visit us at rhostdev.mushpark.com 4201
23 stars 21 forks source link

Compiler warnings #46

Closed stevensmedia closed 4 years ago

stevensmedia commented 5 years ago

I saw a few that look potentially relevant. So I'm documenting them just in case.

speech.c:109:66: warning: variable ‘i_atr’ set but not used [-Wunused-but-set-variable]
   int say_flags, depth, aflags, say_flags2, no_ansi, i_morgrify, i_atr;

Could be indicative of a typo

tprintf.c:133:26: warning: comparison between pointer and zero character constant [-Wpointer-compare]
      for (bp2 = *bp; bp2 != '\0' && bp2 != &buff[end]; bp2++);

Probably should write this as 0 not '\0'?

news.c: In function ‘news_off’:
news.c:4274:34: warning: ‘.news.deleted_news’ directive writing 18 bytes into a region of size between 12 and 170 [-Wformat-overflow=]
     sprintf(flatfile_name, "%s/%s.news.deleted_news", mudconf.data_dir, mudconf.muddb_name);
news.c:4274:5: note: ‘sprintf’ output between 20 and 178 bytes into a destination of size 171
     sprintf(flatfile_name, "%s/%s.news.deleted_news", mudconf.data_dir, mudconf.muddb_name);

Could be legitimate buffer overflows?

pcre.c: In function ‘set_start_bits’:
pcre.c:1237:27: warning: ‘<<’ in boolean context, did you mean ‘<’ ? [-Wint-in-bool-context]
   if ((tcode[c / 8] && (1 << (c & 7))) != 0) {

How can that term after the && ever be zero? should that be & not &&?

shikage commented 4 years ago

@Chalice and @mrsenile have resolved these. Rhost should now be compiling cleanly without warnings on most systems. If you still see any please update with the environment and specific errors.