View Issue Details

IDProjectCategoryView StatusLast Update
0005961Kali LinuxGeneral Bugpublic2020-12-01 10:41
Reporter__chris Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionopen 
Product Versionkali-dev 
Summary0005961: In the C language,use the second rank pointer and memset.But some mermory units are not set to 0
Description

My code is down here.When I run my code on winodws and mac the error doesn't happen.

Steps To Reproduce

#include<stdlib.h>
#include<string.h>
#include<stdio.h>
#define N 10
void print_matrix(int* matrix,int n)
{
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
printf("%d\t",matrix[i][j]);
}
puts("");
puts("");
}
}
int main()
{
int
book;
int** matrix;

    matrix=(int**)malloc(sizeof(int*)*N);
    matrix[0]=(int*)malloc(sizeof(int)*N*N);
    for(int i=1;i&lt;N;i++)
    {
        matrix[i]=matrix[i-1]+sizeof(int)*N;
    }
    memset(matrix[0],0,sizeof(int)*N*N);

    print_matrix(matrix,N);
    free(matrix[0]);
    free(matrix);

}

Attached Files

Activities

g0tmi1k

g0tmi1k

2020-12-01 10:41

administrator   ~0013808

This report has been filed against an old version of Kali. We will be closing this ticket due to inactivity.
Please could you see if you are able to replicate this issue with the latest version of Kali Linux (https://www.kali.org/downloads/)?
If you are still facing the same problem, feel free to re-open the ticket. If you choose to do this, could you provide more information to the issue you are facing, and also give information about your setup?
For more information, please read: https://kali.training/topic/filing-a-good-bug-report/

Issue History

Date Modified Username Field Change
2019-12-28 08:08 __chris New Issue
2019-12-28 08:08 __chris File Added: 2019-12-28 16-01-53 的屏幕截图.png
2020-12-01 10:41 g0tmi1k Note Added: 0013808
2020-12-01 10:41 g0tmi1k Status new => closed