Bug 3324 - Removing servers from favorites list in q3_ui/ui_servers2.c
Status: RESOLVED FIXED
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Misc
Version: unspecified
Hardware: All All
: P3 normal
Assignee: Zachary J. Slater
QA Contact: ioquake3 bugzilla mailing list
URL:
Depends on:
Blocks:
 
Reported: 2007-08-23 04:05 EDT by beast
Modified: 2007-08-23 17:33:13 EDT
0 users

See Also:


Attachments
Diff file with a proposed fix (2.32 KB, patch)
2007-08-23 04:06 EDT, beast

Description beast 2007-08-23 04:05:51 EDT
In q3_ui/ui_servers2.c, in the function ArenaServers_Remove, there is an incorrect value being used when shifting the servers up the list. The current code uses sizeof(MAX_ADDRESSLENGTH) and should use MAX_ADDRESSLENGTH. This happens around line number 580 and also around line 596. Both lines are memcpy calls.

I have attached a .diff file, with several other changes in the surrounding code. The code was a little messy, so I cleaned it up. I also added a memset to zero for the last element in the list after the list has been shifted up. This is not strictly needed, but ensures that the data will not accidentally show up again (which it does with the current bug) if there are other bugs.

Obviously, the only required change is removal of the sizeof() that wraps MAX_ADDRESSLENGTH, so do as you wish... Thanks...
Comment 1 beast 2007-08-23 04:06:50 EDT
Created attachment 1483 [details]
Diff file with a proposed fix
Comment 2 Tim Angus 2007-08-23 08:00:32 EDT
Fixed, pending commit.

Please generate patches from the root directory. It avoids having to manually specify which file to patch. This isn't such a big deal when only one file is affected but it becomes unworkable for larger patches.

tma@abraxas:~/projects/ioq3-trunk$ patch -p0 < patches/ui_servers2.diff 
(Stripping trailing CRs from patch.)
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: ui_servers2.c
|===================================================================
|--- ui_servers2.c      (revision 1129)
|+++ ui_servers2.c      (working copy)
--------------------------
File to patch: code/q3_ui/ui_servers2.c
patching file code/q3_ui/ui_servers2.c
tma@abraxas:~/projects/ioq3-trunk$
Comment 3 Tim Angus 2007-08-23 08:00:45 EDT
Duh.
Comment 4 beast 2007-08-23 12:58:24 EDT
Ok. Sorry. If I am understanding correctly, make sure that patches are from code/dirname/filename.
Comment 5 Tim Angus 2007-08-23 17:33:13 EDT
No, from the root directory. i.e., if you have ioq3 checked out in a directory called ioq3, generate the patches from there. Subversion makes this easy; if you edit your tree then run "svn diff" in the root directory, you'll get a unified diff to stdout.