Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Array returned from INEWS_getAllQueuesInfo() wasn't null-terminated, …
…causing

 a crash in ignus when you clicked the "Queues" button.
  • Loading branch information
icculus committed May 31, 2005
1 parent 47ec12e commit 6b5d687
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libinews/utility.c
Expand Up @@ -65,10 +65,11 @@ QueueInfo *INEWS_getQueueInfo(int qid) {
QueueInfo **INEWS_getAllQueuesInfo() {
QueueInfo **retval;
IList *iter = qinfoptr;
Uint32 i;

retval = (QueueInfo **)malloc(ilist_length(qinfoptr) * sizeof(QueueInfo *));
retval = (QueueInfo **)malloc((ilist_length(qinfoptr) + 1) * sizeof(QueueInfo *));

for (Uint32 i = 0; i < ilist_length(qinfoptr); i++, iter = ilist_next(iter)) {
for (i = 0; i < ilist_length(qinfoptr); i++, iter = ilist_next(iter)) {
QueueInfo *temp;

temp = (QueueInfo *)malloc(sizeof(QueueInfo));
Expand All @@ -78,6 +79,7 @@ QueueInfo **INEWS_getAllQueuesInfo() {
retval[i] = temp;
}

retval[i] = NULL;
return retval;
}

Expand Down

0 comments on commit 6b5d687

Please sign in to comment.