diff --git a/src/XrdHTTP/XrdHttpProtocol.cc b/src/XrdHTTP/XrdHttpProtocol.cc index 2d38ed27f02..83892147cdd 100644 --- a/src/XrdHTTP/XrdHttpProtocol.cc +++ b/src/XrdHTTP/XrdHttpProtocol.cc @@ -967,10 +967,10 @@ int XrdHttpProtocol::BuffgetData(int blen, char **data, bool wait) { } if (myBuffStart < myBuffEnd) { - rlen = min((long) blen, myBuffEnd - myBuffStart); + rlen = min( (long) blen, (long)(myBuffEnd - myBuffStart) ); } else - rlen = min((long) blen, myBuff->buff + myBuff->bsize - myBuffStart); + rlen = min( (long) blen, (long)(myBuff->buff + myBuff->bsize - myBuffStart) ); *data = myBuffStart; BuffConsume(rlen); diff --git a/src/XrdHTTP/XrdHttpReq.cc b/src/XrdHTTP/XrdHttpReq.cc index 02704f3cf98..2ce0c5551a9 100644 --- a/src/XrdHTTP/XrdHttpReq.cc +++ b/src/XrdHTTP/XrdHttpReq.cc @@ -1788,7 +1788,7 @@ int XrdHttpReq::PostProcessHTTPReq(bool final) { while (startp - (char *) iovP[0].iov_base < (unsigned) iovP[0].iov_len - 1) { // Find the filename, it comes before the \n - if ((endp = (char *) strchrnul((const char*) startp, '\n'))) { + if ((endp = (char *) mystrchrnul((const char*) startp, '\n'))) { strncpy(entry, (char *) startp, endp - startp); entry[endp - startp] = 0; e.path = entry; diff --git a/src/XrdHTTP/XrdHttpUtils.cc b/src/XrdHTTP/XrdHttpUtils.cc index b702c213959..02a817b0186 100644 --- a/src/XrdHTTP/XrdHttpUtils.cc +++ b/src/XrdHTTP/XrdHttpUtils.cc @@ -149,7 +149,15 @@ std::string itos(long i) { +// Home made implementation of strchrnul +char *mystrchrnul(const char *s, int c) { + char *ptr = strchr((char *)s, c); + if (!ptr) + return strchr((char *)s, '\0'); + + return ptr; +} diff --git a/src/XrdHTTP/XrdHttpUtils.hh b/src/XrdHTTP/XrdHttpUtils.hh index 583cfc980e7..cc15be94728 100644 --- a/src/XrdHTTP/XrdHttpUtils.hh +++ b/src/XrdHTTP/XrdHttpUtils.hh @@ -49,6 +49,9 @@ int parseURL(char *url, char *host, int &port, char **path); // Simple itoa function std::string itos(long i); +// Home made implementation of strchrnul +char *mystrchrnul(const char *s, int c); + void calcHashes( char *hash,