8000 Build (make) fails with the getEpid function? · Issue #90 · Wind4/vlmcsd · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Aug 14, 2024. It is now read-only.

Build (make) fails with the getEpid function? #90

Open
remcodelange opened this issue Apr 22, 2024 · 2 comments
Open

Build (make) fails with the getEpid function? #90

remcodelange opened this issue Apr 22, 2024 · 2 comments

Comments

@remcodelange
Copy link

The docker compose build fails.
Im using this dockerfile:

FROM alpine:latest as builder
WORKDIR /root
RUN apk add --no-cache git make build-base && \
    git clone --branch master --single-branch https://github.com/Wind4/vlmcsd.git && \
    cd vlmcsd/ && \
    make

FROM alpine:latest
WORKDIR /root/
COPY --from=builder /root/vlmcsd/bin/vlmcsd /usr/bin/vlmcsd
EXPOSE 1688/tcp
CMD [ "/usr/bin/vlmcsd", "-D", "-d" ]

Then i get this error with the make command:

kms.c: In function 'getEpid':
kms.c:502:9: warning: dangling pointer 'pid' to 'ePid' may be used [-Wdangling-pointer=]
  502 |         getEpidFromString(baseResponse, pid);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kms.c:473:30: note: 'ePid' declared here
  473 |                         char ePid[PID_BUFFER_SIZE];
      |                              ^~~~
        LD      ../bin/vlmcsd <- vlmcsd.o kmsdata.o crypto.o kms.o endian.o output.o shared_globals.o helpers.o network.o rpc.o crypto_internal.o
        LD      ../bin/vlmcs <- vlmcs.o kmsdata-full.o crypto.o kms.o endian.o output.o shared_globals.o helpers.o network.o 
8000
rpc.o crypto_internal.o dns_srv.o
gmake[1]: Leaving directory '/root/vlmcsd/src'

Can you guys help me?

@Zarniwoops
Copy link

This is a bug in the code that needs to be patched.

The problem:

  • char ePid[PID_BUFFER_SIZE]; is declared within a block {}
  • pid is set to point to that memory
  • ePid is lost when the block {} scope ends
  • pid now points to uncertain memory that may be trashed at any moment.
  • This is your "dangling pointer"

Quick fix:

  • Move "char ePid[PID_BUFFER_SIZE];" up a few lines just after "const char* pid;"
  • It will remain in scope and is safe to use.

@remcodelange
Copy link
Author

Thank you, I feel like an idiot.
Just changed the kms.c file and moved the line 473 to after 467 and now it works again.

lshw added a commit to lshw/vlmcsd that referenced this issue Apr 16, 2025
kms.c: In function 'getEpid':
kms.c:502:9: warning: dangling pointer 'pid' to 'ePid' may be used [-Wdangling-pointer=]
  502 |         getEpidFromString(baseResponse, pid);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kms.c:473:30: note: 'ePid' declared here
  473 |                         char ePid[PID_BUFFER_SIZE];
      |                              ^~~~
        LD      ../bin/vlmcsd <- vlmcsd.o kmsdata.o crypto.o kms.o endian.o output.o shared_globals.o helpers.o network.o rpc.o crypto_internal.o
        LD      ../bin/vlmcs <- vlmcs.o kmsdata-full.o crypto.o kms.o endian.o output.o shared_globals.o helpers.o network.o rpc.o crypto_internal.o dns_srv.o
gmake[1]: Leaving directory '/root/vlmcsd/src'
lshw added a commit to lshw/vlmcsd that referenced this issue Apr 16, 2025
kms.c: In function 'getEpid':
kms.c:502:9: warning: dangling pointer 'pid' to 'ePid' may be used [-Wdangling-pointer=]
  502 |         getEpidFromString(baseResponse, pid);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kms.c:473:30: note: 'ePid' declared here
  473 |                         char ePid[PID_BUFFER_SIZE];
      |                              ^~~~
        LD      ../bin/vlmcsd <- vlmcsd.o kmsdata.o crypto.o kms.o endian.o output.o shared_globals.o helpers.o network.o rpc.o crypto_internal.o
        LD      ../bin/vlmcs <- vlmcs.o kmsdata-full.o crypto.o kms.o endian.o output.o shared_globals.o helpers.o network.o rpc.o crypto_internal.o dns_srv.o
gmake[1]: Leaving directory '/root/vlmcsd/src'
lshw added a co 7483 mmit to lshw/vlmcsd that referenced this issue Apr 16, 2025
kms.c: In function 'getEpid':
kms.c:502:9: warning: dangling pointer 'pid' to 'ePid' may be used [-Wdangling-pointer=]
  502 |         getEpidFromString(baseResponse, pid);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kms.c:473:30: note: 'ePid' declared here
  473 |                         char ePid[PID_BUFFER_SIZE];
      |                              ^~~~
        LD      ../bin/vlmcsd <- vlmcsd.o kmsdata.o crypto.o kms.o endian.o output.o shared_globals.o helpers.o network.o rpc.o crypto_internal.o
        LD      ../bin/vlmcs <- vlmcs.o kmsdata-full.o crypto.o kms.o endian.o output.o shared_globals.o helpers.o network.o rpc.o crypto_internal.o dns_srv.o
gmake[1]: Leaving directory '/root/vlmcsd/src'
lshw added a commit to lshw/vlmcsd that referenced this issue Apr 17, 2025
kms.c: In function 'getEpid':
kms.c:502:9: warning: dangling pointer 'pid' to 'ePid' may be used [-Wdangling-pointer=]
  502 |         getEpidFromString(baseResponse, pid);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kms.c:473:30: note: 'ePid' declared here
  473 |                         char ePid[PID_BUFFER_SIZE];
      |                              ^~~~
        LD      ../bin/vlmcsd <- vlmcsd.o kmsdata.o crypto.o kms.o endian.o output.o shared_globals.o helpers.o network.o rpc.o crypto_internal.o
        LD      ../bin/vlmcs <- vlmcs.o kmsdata-full.o crypto.o kms.o endian.o output.o shared_globals.o helpers.o network.o rpc.o crypto_internal.o dns_srv.o
gmake[1]: Leaving directory '/root/vlmcsd/src'
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0