]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
daemon/lldpd: fix off-by-one issue when PRETTY_NAME is empty
authorVincent Bernat <vincent@bernat.ch>
Sun, 26 Oct 2025 08:20:45 +0000 (09:20 +0100)
committerVincent Bernat <vincent@bernat.ch>
Sun, 26 Oct 2025 08:21:31 +0000 (09:21 +0100)
src/daemon/lldpd.c

index 78dffee8d1c44502664c6a2b0ba4d7c65b75e218..a4f1a8af46f62e60af68f1675f16aecaaafc04c1 100644 (file)
@@ -871,7 +871,7 @@ lldpd_get_os_release()
        fclose(fp);
 
        /* Remove trailing newline and all " in the string. */
-       ptr1 = release + strlen(release) - 1;
+       ptr1 = release + strlen(release);
        while (ptr1 != release && ((*ptr1 == '"') || (*ptr1 == '\n'))) {
                *ptr1 = '\0';
                ptr1--;