PDP-10 / klh10

Community maintained version of Kenneth L. Harrenstien's PDP-10 emulator.
Other
59 stars 7 forks source link

Warning in build for bld-ks-its #45

Closed DavidGriffith closed 4 years ago

DavidGriffith commented 4 years ago

Towards the end of building the bld-ks-its target, I get this warning:

../../src/dpimp.c: In function âarp_reqâ:
../../src/dpimp.c:1210:2: warning: âmemcpyâ reading 6 bytes from a region of size 4 [-Wstringop-overflow=]
  memcpy((char *)arp.arp.arp_spa,  /* Sender IP addr */
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   (char *)&ihost_ip, sizeof(arp.arp.arp_sha));
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc  -o dpimp dpimp.o dpsup.o  
Rhialto commented 4 years ago

Indeed! That warning seems to be right. The memcpy is copying into the field arp.arp.arp_spa but using the size of arp.arp.arp_sha. I would say that it needs to use the same size, right?

Rhialto commented 4 years ago

I made that cheange, can you check it gets rid of the warning for you?

I also started to make more changes to remove warnings from -Wall but I was shocked at how many they are. I did just a few.

DavidGriffith commented 4 years ago

That does the trick. Thanks!