Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.bugs.dist > #1019190

Bug#966194: Wrong code in the report

From Rick Stanley <rick@scotsgeek.com>
Newsgroups linux.debian.bugs.dist
Subject Bug#966194: Wrong code in the report
Date 2020-07-24 22:40 +0200
Message-ID <AwcE1-3p5-3@gated-at.bofh.it> (permalink)
References <Aw7O2-wk-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Correct code that created the error message in valgrind:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define DIM 32

int main(void)
{
   char *p = NULL;

   p = malloc(DIM);

   if(p == NULL)
   {
      printf("Allocation error.\n");
      exit(1);
   }

   strcpy(p, "This is a test.");

   for(int x = 0 ; x < DIM; ++x)
   {
      printf("%02x ",  p[x]);
   }
   putchar('\n');

   free(p);

   return 0;
}

Back to linux.debian.bugs.dist | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Bug#966194: gcc-9: valgrind error: Conditional jump or move depends on uninitialised value(s) Rick Stanley <rick@scotsgeek.com> - 2020-07-24 17:30 +0200
  Bug#966194: Wrong code in the report Rick Stanley <rick@scotsgeek.com> - 2020-07-24 22:40 +0200
  Bug#966194: Cancel report! Rick Stanley <rick@scotsgeek.com> - 2020-07-25 20:00 +0200

csiph-web