View Issue Details

IDProjectCategoryView StatusLast Update
0003939unrealircdpublic2010-08-04 02:04
Reporterwarg Assigned Toohnobinki  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.2.9-RC1 
Fixed in Version3.2.9-RC1 
Summary0003939: patch to fix for various compiler warnings
Descriptionpatch fixes these warnings:

# GCC 4.4.4
ssl.c: In function ‘ssl_get_cipher’:
ssl.c:437: warning: assignment discards qualifiers from pointer target type

# GCC 4.3.2
s_user.c: In function ‘check_for_target_limit’:
s_user.c:463: warning: cast from pointer to integer of different size

# GCC 4.3.2
support.c: In function ‘encode_ip’:
support.c:1824: warning: cast to pointer from integer of different size
TagsNo tags attached.
Attached Files
warg-warn-fix.patch (1,205 bytes)
3rd party modules

Relationships

has duplicate 0003929 closed patch for ssl.c:437: warning: assignment discards qualifiers from pointer target type 

Activities

syzop

2010-07-22 12:19

administrator   ~0016241

I wonder if binki can spot the error in this patch ;)

ohnobinki

2010-07-22 14:08

reporter   ~0016243

base64 encoding a pointer instead of an IP address?

I'd have to look at the context to verify the last two chunks of the patch.

syzop

2010-07-22 15:22

administrator   ~0016245

Last edited: 2010-07-22 15:23

exactly.. in chunk 2 and 3 you now deal with the pointer itself, which would result in broken nickip and broken target flood detection.

3 obviously just not add the & I think.
for 2.. if you look at the CURRENT code, it's pretty mysterious :P. Basically a pointer is set to the value of the ip (aka: to the IP itself), and then the pointer is b64encoded. Ok, that might work, but is rather... odd. presumably for 2 the & as in the patch should be done, and the & should be removed for the b64_encode in the line under it? Or maybe you could even do without using 'cp' in that part. I did not test...

If you, binki, would like to take this, and test it, then feel free to commit for 3.2.9. (assuming you're not going to rewrite the whole function... but just those few lines :D)

warg

2010-07-22 16:42

reporter   ~0016246

sorry for my mistake

ohnobinki

2010-07-22 19:30

reporter   ~0016247

unreal-3939-fix-casts-const.patch: use double-casting to make GCC happier.

syzop

2010-07-24 22:19

administrator   ~0016249

does this work on non-C99 compilers, binki? Like will it define those types if they don't exist... (see our coding guideline nr 9)

also, like I said for 2.. I'd rather like:
- cp = (u_char *)ia.s_addr;
- b64_encode((char *)&cp, sizeof(struct in_addr), buf, 25);
+ b64_encode((char *)&ia.s_addr, sizeof(struct in_addr), buf, 25);

assuming that fixes the warning for warg too...
warg, could you test that?

On a side note warg, looking at your warnings, they are 64 bit related I think [except for nr 1 of course] :). I can't test it, as I don't have a 64 bit system.

If all from above is satisfied, then feel free to commit.

ohnobinki

2010-07-25 03:04

reporter   ~0016250

> does this work on non-C99 compilers, binki? Like will it define those types if they don't exist... (see our coding guideline nr 9)

The documentation for AC_TYPE_INTPTR_T claims that these types will be defined. Like you can't test the 64-bit-related problems, I can't test this ;-). I suppose that #define-ing this in win32's fixed setup.h would be the correct solution? And hopefully win32 means no 64-bit support...?

syzop

2010-07-25 20:07

administrator   ~0016251

yea, think so :)

ohnobinki

2010-08-04 02:04

reporter   ~0016253

- Fix a few compiler warnings with some double-casting and another const. (0003939)
- Define intptr_t in win32's setup.h. (0003939)

I didn't test much other than that the unrealircd runs, links in normally, and works with clients like I'd expect it to. I.e., I don't know what circumstances cause encode_ip() to be used or how to test the throttling code.

Oh, and I can only hope that my #define in win32/setup.h works ;-).

Issue History

Date Modified Username Field Change
2010-07-20 04:44 warg New Issue
2010-07-20 04:44 warg File Added: warg-warn-fix.patch
2010-07-22 12:19 syzop Note Added: 0016241
2010-07-22 14:08 ohnobinki Note Added: 0016243
2010-07-22 15:22 syzop Note Added: 0016245
2010-07-22 15:23 syzop Note Edited: 0016245
2010-07-22 16:42 warg Note Added: 0016246
2010-07-22 19:29 ohnobinki File Added: unreal-3939-fix-casts-const.patch
2010-07-22 19:30 ohnobinki Note Added: 0016247
2010-07-24 22:19 syzop Note Added: 0016249
2010-07-25 03:04 ohnobinki Note Added: 0016250
2010-07-25 20:07 syzop Note Added: 0016251
2010-08-03 18:33 ohnobinki Relationship added has duplicate 0003929
2010-08-04 02:04 ohnobinki QA => Not touched yet by developer
2010-08-04 02:04 ohnobinki U4: Need for upstream patch => No need for upstream InspIRCd patch
2010-08-04 02:04 ohnobinki Note Added: 0016253
2010-08-04 02:04 ohnobinki Status new => resolved
2010-08-04 02:04 ohnobinki Fixed in Version => 3.2.9-RC1
2010-08-04 02:04 ohnobinki Resolution open => fixed
2010-08-04 02:04 ohnobinki Assigned To => ohnobinki