Xref: utzoo comp.unix.questions:13149 comp.unix.wizards:15835 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!biar!trebor From: trebor@biar.UUCP (Robert J Woodhead) Newsgroups: comp.unix.questions,comp.unix.wizards Subject: Re: system() --- the C function from hell? Keywords: system, unix, question, does anyone use this line? Message-ID: <515@biar.UUCP> Date: 30 Apr 89 19:55:46 GMT References: <1827@uop.edu> Reply-To: trebor@biar.UUCP (Robert J Woodhead) Followup-To: comp.unix.questions Organization: Biar Games, Inc. Lines: 18 In article <1827@uop.edu> jeff@uop.edu (Jeff Ferguson) writes: >int lowp, hip; >scanf("%d", &hip); >scanf("%d", &lowp); >sprintf(str, "/bin/mkdir directory"); >system(str); I note that you haven't given us the definition of ``str''. I would like to see this definition, for if str was not long enough to hold "/bin/mkdir directory" plus the termination byte, and was defined so the compiler put it in memory right before lowp and hip, it would be possible for the sprintf to trash the integers. -- Robert J Woodhead, Biar Games, Inc. ...!uunet!biar!trebor | trebor@biar.UUCP "The NY Times is read by the people who run the country. The Washington Post is read by the people who think they run the country. The National Enquirer is read by the people who think Elvis is alive and running the country..."