Your message dated Mon, 28 Jan 2019 11:22:10 +0100
with message-id <1b2be55b-1725-bb6d-1471-a2966f0f3...@debian.org>
and subject line Re: [Bug-freedink] Bug#826324: Array out of bounds in loop
has caused the Debian Bug report #826324,
regarding Array out of bounds in loop
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
826324: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=826324
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: freedink
Version: 108.4-1
Severity: normal

While compiling the package from the Debian source, I saw a warning about
undefined behavior, and it is indeed a bug.

In src/dinkc.c, MAX_CALLBACKS is defined as 100, and callback is defined as

static struct call_back callback[MAX_CALLBACKS];

There is a comment on it that says:
/* TODO: Used 1->100 in the game, should it be MAX_CALLBACKS+1 ? */

Most of the code uses k < MAX_CALLBACKS to detect the end, so it would work
(but it would also be one short of what the original game expects; I have not 
checked if the original is writing out of bounds).

However, the warning is about line 843, which says k <= MAX_CALLBACKS.

This is wrong, and there are two possible solutions.

1. Change <= into <.  I think this is wrong, because the game expects 
callback[100] to be valid.
2. So instead, the array should be defined as MAX_CALLBACKS + 1 and all the 
other limit checks should be changed into <=.

Thanks,
Bas

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: mipsel, armhf, i386

Kernel: Linux 4.4.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages freedink depends on:
ii  freedink-dfarc   3.12-1+b1
ii  freedink-engine  108.4-1

freedink recommends no packages.

freedink suggests no packages.

-- no debconf information

--- End Message ---
--- Begin Message ---
Fixed in latest upload.

--- End Message ---

Reply via email to