mirror of
				git://git.code.sf.net/p/zsh/code
				synced 2025-10-31 18:10:56 +01:00 
			
		
		
		
	23511: error if here document too large
This commit is contained in:
		
							parent
							
								
									4a1549e058
								
							
						
					
					
						commit
						023f6ce4e1
					
				
					 3 changed files with 22 additions and 1 deletions
				
			
		|  | @ -3111,7 +3111,13 @@ gethere(char *str, int typ) | |||
| 	    ; | ||||
| 	for (;;) { | ||||
| 	    if (bptr == buf + bsiz) { | ||||
| 		buf = realloc(buf, 2 * bsiz); | ||||
| 		char *newbuf = realloc(buf, 2 * bsiz); | ||||
| 		if (!newbuf) { | ||||
| 		    /* out of memory */ | ||||
| 		    zfree(buf, bsiz); | ||||
| 		    return NULL; | ||||
| 		} | ||||
| 		buf = newbuf; | ||||
| 		t = buf + bsiz - (bptr - t); | ||||
| 		bptr = buf + bsiz; | ||||
| 		bsiz *= 2; | ||||
|  |  | |||
							
								
								
									
										10
									
								
								Src/lex.c
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								Src/lex.c
									
										
									
									
									
								
							|  | @ -356,6 +356,16 @@ yylex(void) | |||
| 	    ALLOWHIST | ||||
| 	    cmdpop(); | ||||
| 	    hwend(); | ||||
| 	    if (!name) { | ||||
| 		zerr("here document too large"); | ||||
| 		while (hdocs) { | ||||
| 		    next = hdocs->next; | ||||
| 		    zfree(hdocs, sizeof(struct heredocs)); | ||||
| 		    hdocs = next; | ||||
| 		} | ||||
| 		tok = LEXERR; | ||||
| 		break; | ||||
| 	    } | ||||
| 	    setheredoc(hdocs->pc, REDIR_HERESTR, name); | ||||
| 	    zfree(hdocs, sizeof(struct heredocs)); | ||||
| 	    hdocs = next; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue