Closed Bug 104065 Opened 23 years ago Closed 23 years ago

uninitialized string in "process_bug.cgi" line 92

Categories

(Bugzilla :: Creating/Changing Bugs, defect)

2.14
x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 2.16

People

(Reporter: kwilliams, Assigned: justdave)

References

Details

Attachments

(1 file)

(W uninitialized) An undefined value was used as if it were already defined.  
It was
    interpreted as a "" or a 0, but maybe it was a mistake.  To suppress this
    warning assign a defined value to your variables.
    
[Wed Oct 10 11:24:39 2001] C:\bugzilla-2.14\process_bug.cgi: Use of 
uninitialized value in string ne at C:\bugzilla-2.14\process_bug.cgi line 92.
Content-type: text/html
Kevin: the code has changed too much since 2.14 came out and I don't have a copy
of it handy...  would you happen to be able to look up what's on line 92 and
paste in a few of the surrounding lines here just for context?  thanks.
Here's the code section:

---------------- snip ---------------------------
# If the user has a bug list and is processing one bug, then after
# we process the bug we are going to show them the next bug on their
# list.  Thus we have to make sure this bug ID is also valid,
# since a malicious cracker might alter their cookies for the purpose
# gaining access to bugs they are not authorized to access.
if ( $::COOKIE{"BUGLIST"} ne "" && defined $::FORM{'id'} ) {
    my @buglist = split( /:/ , $::COOKIE{"BUGLIST"} );
    my $idx = lsearch( \@buglist , $::FORM{"id"} );
    if ($idx < $#buglist) {
        my $nextbugid = $buglist[$idx + 1];
        ValidateBugID($nextbugid);
    }
}
------------------------- end snip ---------------------------------
ok, now for the stupid question, which line in that snippet was line 92? :)

Just looking at it though, I'm betting on $::COOKIE{"BUGLIST"} being the
problem, because if the person has cookies turned off, or hasn't viewed any
buglists yet, this cookie wouldn't exist.

We'd be better off changing that to make sure the cookie exists instead of
making sure it's not empty.
Yes, that's the correct line.

Your idea makes sense to me. It seems that we could wrap that code in a 
conditional to test for the cookie first. I've never coded cookies in Perl, so 
I can't help with the code. If you could post that code fix, I would greatly 
appreciate it.
heh, was working on that already.  patch coming right up.
Assignee: myk → justdave
Keywords: patch, review
Target Milestone: --- → Bugzilla 2.16
Makes sense. r=gerv.

Gerv
Comment on attachment 53579 [details] [diff] [review]
check for defined instead of ne ""

I can't think of any time when it would be "" instead of undef, so r=jake
(r1 was Gerv).
Attachment #53579 - Flags: review+
Checking in process_bug.cgi;
/cvsroot/mozilla/webtools/bugzilla/process_bug.cgi,v  <--  process_bug.cgi
new revision: 1.102; previous revision: 1.101
done
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
*** Bug 137893 has been marked as a duplicate of this bug. ***
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: