Linrad 5.02 compile error

11 views
Skip to first unread message

Rob PE1ITR

unread,
Jun 25, 2024, 10:45:34 AM (13 days ago) Jun 25
to Linrad
Hi,

I have a new laptop with linux Fedora 40 installed. Now I'm compiling linrad 5.02 on it. After solving most of the issues, I encountered the error below during the make proces, which I could not solve. Does anyone have a suggestion?
hid.c: In functie ‘hid_enumerate’:
hid.c:1340:33: fout: ‘strncpy’ specified bound depends on the length of the source argument [-Werror=stringop-truncation]
 1340 |                                 strncpy(cur_dev->path, str, len+1);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hid.c:1338:39: note: length computed here
 1338 |                                 len = strlen(str);
      |                                       ^~~~~~~~~~~
cc1: alle waarschuwingen worden als fouten behandeld
make: *** [Makefile:2248: hid.om] Fout 1

73 Rob PE1ITR

Franco Venturi

unread,
Jun 25, 2024, 10:13:29 PM (13 days ago) Jun 25
to Linrad
Rob,
I had the same error message with Linrad this afternoon.

I googled it and I found this question on Stack Overflow that explains how to solve that problem: https://stackoverflow.com/questions/56782248/gcc-specified-bound-depends-on-the-length-of-the-source-argument
As suggested there I replaced that 'strncpy' with a 'strcpy': https://github.com/fventuri/linrad/blob/main/hid.c#L1359

With that change I was able to build Linrad without any errors.

73,
Franco K4VZ

Rob PE1ITR

unread,
Jun 26, 2024, 3:47:04 AM (13 days ago) Jun 26
to Linrad
Hi Franco,

Thank you. That's a similar story.
I replaced strncpy with strcpy and omitted the last parameter. Now Linrad compiles without errors and appears to work normally

73 Rob PE1ITR.

Op woensdag 26 juni 2024 om 04:13:29 UTC+2 schreef Franco Venturi:

Leif Asbrink

unread,
Jun 26, 2024, 5:39:37 AM (13 days ago) Jun 26
to lin...@googlegroups.com
Hi Franco,

Fine! I have also removed the next line:
cur_dev->path[len] = '\0';
The terminating zero is already in place by strcpy

It is now revision 1046 on the linrad repo.

73

Leif
> --
> There is an excellent Linrad User Guide by Gaetan, ON4KHG, at:
> http://w3sz.com/Linrad%20Installation%20&%20Configuration%20User%20Guide%20-%20V1-0.pdf
> ---
> You received this message because you are subscribed to the Google Groups "Linrad" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linrad+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/linrad/9bf19271-9532-489a-a58e-c1cf21739f79n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages