Skip to content

Commit 3ff7e17

Browse files
committed
Merge branch 'maint'
* maint: Documentation: refer to gitworkflows(7) from tutorial and git(1) daemon: Strictly parse the "extra arg" part of the command
2 parents 6096d75 + 801a011 commit 3ff7e17

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

Documentation/git.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ The link:user-manual.html#git-concepts[git concepts chapter of the
232232
user-manual] and linkgit:gitcore-tutorial[7] both provide
233233
introductions to the underlying git architecture.
234234

235+
See linkgit:gitworkflows[7] for an overview of recommended workflows.
236+
235237
See also the link:howto-index.html[howto] documents for some useful
236238
examples.
237239

@@ -649,7 +651,8 @@ SEE ALSO
649651
linkgit:gittutorial[7], linkgit:gittutorial-2[7],
650652
link:everyday.html[Everyday Git], linkgit:gitcvs-migration[7],
651653
linkgit:gitglossary[7], linkgit:gitcore-tutorial[7],
652-
linkgit:gitcli[7], link:user-manual.html[The Git User's Manual]
654+
linkgit:gitcli[7], link:user-manual.html[The Git User's Manual],
655+
linkgit:gitworkflows[7]
653656

654657
GIT
655658
---

Documentation/gittutorial.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,9 @@ digressions that may be interesting at this point are:
650650
smart enough to perform a close-to-optimal search even in the
651651
case of complex non-linear history with lots of merged branches.
652652

653+
* linkgit:gitworkflows[7]: Gives an overview of recommended
654+
workflows.
655+
653656
* link:everyday.html[Everyday GIT with 20 Commands Or So]
654657

655658
* linkgit:gitcvs-migration[7]: Git for CVS users.
@@ -661,6 +664,7 @@ linkgit:gitcvs-migration[7],
661664
linkgit:gitcore-tutorial[7],
662665
linkgit:gitglossary[7],
663666
linkgit:git-help[1],
667+
linkgit:gitworkflows[7],
664668
link:everyday.html[Everyday git],
665669
link:user-manual.html[The Git User's Manual]
666670

connect.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,10 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
579579
git_tcp_connect(fd, host, flags);
580580
/*
581581
* Separate original protocol components prog and path
582-
* from extended components with a NUL byte.
582+
* from extended host header with a NUL byte.
583+
*
584+
* Note: Do not add any other headers here! Doing so
585+
* will cause older git-daemon servers to crash.
583586
*/
584587
packet_write(fd[1],
585588
"%s %s%chost=%s%c",

daemon.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,15 +406,15 @@ static char *xstrdup_tolower(const char *str)
406406
}
407407

408408
/*
409-
* Separate the "extra args" information as supplied by the client connection.
409+
* Read the host as supplied by the client connection.
410410
*/
411-
static void parse_extra_args(char *extra_args, int buflen)
411+
static void parse_host_arg(char *extra_args, int buflen)
412412
{
413413
char *val;
414414
int vallen;
415415
char *end = extra_args + buflen;
416416

417-
while (extra_args < end && *extra_args) {
417+
if (extra_args < end && *extra_args) {
418418
saw_extended_args = 1;
419419
if (strncasecmp("host=", extra_args, 5) == 0) {
420420
val = extra_args + 5;
@@ -436,6 +436,8 @@ static void parse_extra_args(char *extra_args, int buflen)
436436
/* On to the next one */
437437
extra_args = val + vallen;
438438
}
439+
if (extra_args < end && *extra_args)
440+
die("Invalid request");
439441
}
440442

441443
/*
@@ -545,7 +547,7 @@ static int execute(struct sockaddr *addr)
545547
hostname = canon_hostname = ip_address = tcp_port = NULL;
546548

547549
if (len != pktlen)
548-
parse_extra_args(line + len + 1, pktlen - len - 1);
550+
parse_host_arg(line + len + 1, pktlen - len - 1);
549551

550552
for (i = 0; i < ARRAY_SIZE(daemon_service); i++) {
551553
struct daemon_service *s = &(daemon_service[i]);

0 commit comments

Comments
 (0)