Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ Errors with a few new compile flags.
|
Errors with a few new compile flags.
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Greven
Canada (835 posts) Bio
|
| Date
| Sat 03 Apr 2004 09:16 AM (UTC) |
| Message
| | I've been going through with a few compile flags, hoping to add find some buffer overflows or memory leaks, etc. I'm getting a warning as such:
Quote: 65: warning: overflow in implicit constant conversion
comm.c:65: warning: overflow in implicit constant conversion
comm.c:66: warning: overflow in implicit constant conversion
comm.c:66: warning: overflow in implicit constant conversion
comm.c:67: warning: overflow in implicit constant conversion
comm.c:67: warning: overflow in implicit constant conversion and here is the corresponding code:const char echo_off_str[] = { IAC, WILL, TELOPT_ECHO, '\0' };
const char echo_on_str[] = { IAC, WONT, TELOPT_ECHO, '\0' };
const char go_ahead_str[] = { IAC, GA, '\0' };
I'm assuming that its saying that these characters are not a singular character long, but from what I understand, telnet codes like these are all 1 character? Maybe someone could explain what this means? |
Nobody ever expects the spanish inquisition!
darkwarriors.net:4848
http://darkwarriors.net | | Top |
|
| Posted by
| Samson
USA (683 posts) Bio
|
| Date
| Reply #1 on Sat 03 Apr 2004 04:29 PM (UTC) |
| Message
| | What compiler flag did you use to generate those warnings with? | | Top |
|
| Posted by
| Greven
Canada (835 posts) Bio
|
| Date
| Reply #2 on Sat 03 Apr 2004 05:22 PM (UTC) |
| Message
| -Wpointer-arith -Wstrict-prototypes -O2 -pedantic
I beleive that its the pedantic flag that does it, but I haven't confirmed. I was reading through some documents on buffer overflows and such, and it recommended these flags. Might not work with telnet code, though. |
Nobody ever expects the spanish inquisition!
darkwarriors.net:4848
http://darkwarriors.net | | Top |
|
| Posted by
| Samson
USA (683 posts) Bio
|
| Date
| Reply #3 on Sun 04 Apr 2004 05:21 AM (UTC) |
| Message
| | Ah yes, the pedantic flag. The one flag I've yet to use on my code because the last time I tried it I got so many errors it was overwhelming. Perhaps I will revisit it now, for the curiosity factor :) | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #4 on Mon 05 Apr 2004 10:06 PM (UTC) |
| Message
| IAC is defined as 0xFF which is effectively 255.
A char is a one-byte *signed* field, so effectively it can be from -128 to +127. Thus, 0xFF "overflows" a signed char byte.
One approach would be to define it:
const unsigned char echo_off_str[] = { IAC, WILL, TELOPT_ECHO, '\0' };
I think you then get other warnings which you need to work around. :) (eg. passing unsigned char to a routine that expects signed char).
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Greven
Canada (835 posts) Bio
|
| Date
| Reply #5 on Wed 07 Apr 2004 04:29 AM (UTC) |
| Message
| | Heh, yeah, that was exactly it. Thanks alot, had to do a couple casts, wasn't much, thanks. |
Nobody ever expects the spanish inquisition!
darkwarriors.net:4848
http://darkwarriors.net | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
14,569 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top